Repository: qpid-proton Updated Branches: refs/heads/master 180718f07 -> 24a2ed321
PROTON-1474: Fix CMake config files and cmake files so that Proton C examples compile separately - This reverts commit ed9532e2ae08b04aa5690d43e9002431bd019c21.A - This introduces Core and Proactor package components to the Proton CMake config script Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/24a2ed32 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/24a2ed32 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/24a2ed32 Branch: refs/heads/master Commit: 24a2ed32134e2ae5610be3eb46b9817a40ba969b Parents: 180718f Author: Andrew Stitcher <[email protected]> Authored: Fri May 5 18:13:34 2017 -0400 Committer: Andrew Stitcher <[email protected]> Committed: Wed May 10 20:05:18 2017 -0400 ---------------------------------------------------------------------- examples/ProtonConfig.cmake | 23 +++++++++++++++++++++-- examples/c/CMakeLists.txt | 4 +++- examples/c/proactor/CMakeLists.txt | 12 +++++------- proton-c/CMakeLists.txt | 8 +++----- proton-c/src/ProtonConfig.cmake.in | 25 +++++++++++++++++++------ 5 files changed, 51 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/24a2ed32/examples/ProtonConfig.cmake ---------------------------------------------------------------------- diff --git a/examples/ProtonConfig.cmake b/examples/ProtonConfig.cmake index fe8709c..e0a2ff8 100644 --- a/examples/ProtonConfig.cmake +++ b/examples/ProtonConfig.cmake @@ -28,8 +28,27 @@ # tree build and installed in the appropriate place for cmake on that system. set (Proton_VERSION ${PN_VERSION}) + set (Proton_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/proton-c/include) set (Proton_LIBRARIES qpid-proton) -set (ProtonCore_LIBRARIES qpid-proton-core) -set (ProtonProactor_LIBRARIES qpid-proton-proactor) set (Proton_FOUND True) + +set (Proton_Core_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/proton-c/include) +set (Proton_Core_LIBRARIES qpid-proton-core) +set (Proton_Core_FOUND True) + +if (${HAS_PROACTOR}) + set (Proton_Proactor_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/proton-c/include) + set (Proton_Proactor_LIBRARIES qpid-proton-proactor) + set (Proton_Proactor_FOUND True) +endif() + +# Check for all required components +foreach(comp ${Proton_FIND_COMPONENTS}) + if(NOT Proton_${comp}_FOUND) + if(Proton_FIND_REQUIRED_${comp}) + set(Proton_FOUND FALSE) + set(Proton_NOT_FOUND_MESSAGE "Didn't find required component ${comp}") + endif() + endif() +endforeach() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/24a2ed32/examples/c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/c/CMakeLists.txt b/examples/c/CMakeLists.txt index 0fed71b..c78e04c 100644 --- a/examples/c/CMakeLists.txt +++ b/examples/c/CMakeLists.txt @@ -21,6 +21,8 @@ find_package(Proton REQUIRED) include(CheckCCompilerFlag) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -add_subdirectory(proactor) +if(Proton_Proactor_FOUND) + add_subdirectory(proactor) +endif() add_subdirectory(messenger) add_subdirectory(reactor) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/24a2ed32/examples/c/proactor/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/examples/c/proactor/CMakeLists.txt b/examples/c/proactor/CMakeLists.txt index 9759a7c..11fb073 100644 --- a/examples/c/proactor/CMakeLists.txt +++ b/examples/c/proactor/CMakeLists.txt @@ -17,12 +17,13 @@ # under the License. # -find_package(Proton REQUIRED) +find_package(Proton REQUIRED Core Proactor) +set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +find_package(Threads REQUIRED) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${Proton_INCLUDE_DIRS}) -if(HAS_PROACTOR) - add_definitions(${COMPILE_LANGUAGE_FLAGS} ${COMPILE_WARNING_FLAGS} ${WERROR} ${COMPILE_PLATFORM_FLAGS} ${LINK_TIME_OPTIMIZATION}) # Add a test with the correct environment to find test executables and valgrind. @@ -30,16 +31,13 @@ if(WIN32) set(test_path "$<TARGET_FILE_DIR:broker>;$<TARGET_FILE_DIR:qpid-proton>") else(WIN32) set(test_path "${CMAKE_CURRENT_BINARY_DIR}:$ENV{PATH}") - set(PLATFORM_LIBS pthread) endif(WIN32) foreach(name broker send receive direct) add_executable(proactor-${name} ${name}.c) - target_link_libraries(proactor-${name} ${ProtonProactor_LIBRARIES} ${PLATFORM_LIBS}) + target_link_libraries(proactor-${name} ${Proton_Proactor_LIBRARIES} ${Proton_Core_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) set_target_properties(proactor-${name} PROPERTIES OUTPUT_NAME ${name}) endforeach() set(run_env ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/proton-c/env.py ${EXAMPLE_ENV} "PATH=${test_path}" ${VALGRIND_ENV}) add_test(c-example-proactor ${run_env} -- ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test.py -v) - -endif(HAS_PROACTOR) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/24a2ed32/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index 5589a11..33933b8 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -608,8 +608,9 @@ if (MSVC) endif(MSVC) if (qpid-proton-proactor) - set(HAS_PROACTOR 1) - set(HAS_PROACTOR 1 PARENT_SCOPE) # Visible to examples + # Bizarre CMake variable setting + set(HAS_PROACTOR True) + set(HAS_PROACTOR ${HAS_PROACTOR} PARENT_SCOPE) add_library ( qpid-proton-proactor SHARED ${qpid-proton-proactor}) target_link_libraries (qpid-proton-proactor LINK_PUBLIC qpid-proton-core) @@ -666,9 +667,6 @@ configure_lib(PROTONLIB qpid-proton) configure_lib(PROTONCORELIB qpid-proton-core) if(HAS_PROACTOR) configure_lib(PROTONPROACTORLIB qpid-proton-proactor) - # For ProtonConfig.in - set(PROTONPROACTOR_INCLUDE_DIRS ${INCLUDEDIR}) - set(PROTONPROACTOR_LIBRARIES "optimized ${LIBDIR}/${PROTONPROACTORLIB} debug ${LIBDIR}/${PROTONPROACTORLIBDEBUG}") endif(HAS_PROACTOR) include(WriteBasicConfigVersionFile) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/24a2ed32/proton-c/src/ProtonConfig.cmake.in ---------------------------------------------------------------------- diff --git a/proton-c/src/ProtonConfig.cmake.in b/proton-c/src/ProtonConfig.cmake.in index 5a09d68..5b23be0 100644 --- a/proton-c/src/ProtonConfig.cmake.in +++ b/proton-c/src/ProtonConfig.cmake.in @@ -26,12 +26,25 @@ set (Proton_VERSION @PN_VERSION@) set (Proton_INCLUDE_DIRS @INCLUDEDIR@) set (Proton_LIBRARIES optimized @LIBDIR@/@PROTONLIB@ debug @LIBDIR@/@PROTONLIBDEBUG@) +set (Proton_FOUND True) -set (ProtonCore_INCLUDE_DIRS @INCLUDEDIR@) -set (ProtonCore_LIBRARIES optimized @LIBDIR@/@PROTONCORELIB@ debug @LIBDIR@/@PROTONCORELIBDEBUG@) +set (Proton_Core_INCLUDE_DIRS @INCLUDEDIR@) +set (Proton_Core_LIBRARIES optimized @LIBDIR@/@PROTONCORELIB@ debug @LIBDIR@/@PROTONCORELIBDEBUG@) +set (Proton_Core_FOUND True) -set (ProtonProactor_INCLUDE_DIRS @PROTONPROACTOR_INCLUDE_DIRS@) -set (ProtonProactor_LIBRARIES @PROTONPROACTOR_LIBRARIES@) -set (ProtonProactor_FOUND @HAS_PROACTOR@) +set (HAS_PROACTOR @HAS_PROACTOR@) +if (HAS_PROACTOR) + set (Proton_Proactor_INCLUDE_DIRS @INCLUDEDIR@) + set (Proton_Proactor_LIBRARIES optimized @LIBDIR@/@PROTONPROACTORLIB@ debug @LIBDIR@/@PROTONPROACTORLIBDEBUG@) + set (Proton_Proactor_FOUND True) +endif() -set (Proton_FOUND True) +# Check for all required components +foreach(comp ${Proton_FIND_COMPONENTS}) + if(NOT Proton_${comp}_FOUND) + if(Proton_FIND_REQUIRED_${comp}) + set(Proton_FOUND FALSE) + set(Proton_NOT_FOUND_MESSAGE "Didn't find required component ${comp}") + endif() + endif() +endforeach() --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
