PROTON-1143: Simplified some of the CMake system with 2.8.7 features
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/26553f01 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/26553f01 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/26553f01 Branch: refs/heads/master Commit: 26553f0123bed0cd5997eafc516a0116552da9d5 Parents: 36059eb Author: Andrew Stitcher <[email protected]> Authored: Mon Feb 22 14:39:07 2016 -0500 Committer: Andrew Stitcher <[email protected]> Committed: Tue Feb 23 00:36:10 2016 -0500 ---------------------------------------------------------------------- proton-c/CMakeLists.txt | 42 +++++++++----------- proton-c/bindings/cpp/CMakeLists.txt | 17 ++++---- .../cpp/ProtonCppConfigVersion.cmake.in | 30 -------------- proton-c/src/ProtonConfigVersion.cmake.in | 30 -------------- proton-c/src/tests/CMakeLists.txt | 4 +- 5 files changed, 29 insertions(+), 94 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index 0f60ce0..6e755a9 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -336,9 +336,9 @@ set (qpid-proton-core src/messenger/store.c src/messenger/transform.c src/selectable.c + ) - src/config.h - +set (qpid-proton-extra-deps ${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h ${CMAKE_CURRENT_BINARY_DIR}/src/protocol.h ) @@ -391,12 +391,20 @@ set_source_files_properties ( COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}" ) +if (BUILD_WITH_CXX) + set_source_files_properties ( + ${qpid-proton-core} ${qpid-proton-platform} + PROPERTIES LANGUAGE CXX + ) +endif (BUILD_WITH_CXX) + add_library ( qpid-proton SHARED ${qpid-proton-core} ${qpid-proton-platform} ${qpid-proton-include} + ${qpid-proton-extra-deps} ) target_link_libraries (qpid-proton ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) @@ -414,19 +422,6 @@ if (MSVC) include(WindowsC99CheckDef) endif(MSVC) -macro(pn_c_files) - foreach (src_file ${ARGN}) - if (${src_file} MATCHES "^.*[.]c$") - if (BUILD_WITH_CXX) - # tell CMake to use C++ for proton source files ending in ".c" - set_source_files_properties (${src_file} PROPERTIES LANGUAGE CXX) - endif (BUILD_WITH_CXX) - endif (${src_file} MATCHES "^.*[.]c$") - endforeach (src_file) -endmacro(pn_c_files) - -pn_c_files (${qpid-proton-core} ${qpid-proton-platform}) - # Install executables and libraries install (TARGETS qpid-proton EXPORT proton @@ -436,13 +431,9 @@ install (TARGETS qpid-proton # Install windows qpid-proton pdb files if (MSVC) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/qpid-proton${CMAKE_DEBUG_POSTFIX}.pdb + install(FILES $<TARGET_PDB_FILE:qpid-proton> DESTINATION bin - CONFIGURATIONS Debug - OPTIONAL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/qpid-proton.pdb - DESTINATION bin - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS RelWithDebInfo Debug OPTIONAL) endif (MSVC) @@ -468,12 +459,15 @@ set(PROTONLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton${CMAKE_SHARED_LIBRARY_SU set(PROTONLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) endif () +include(WriteBasicConfigVersionFile) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/ProtonConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfig.cmake @ONLY) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/src/ProtonConfigVersion.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake @ONLY) +write_basic_config_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake + VERSION ${PN_VERSION} + COMPATIBILITY AnyNewerVersion) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/proton-c/bindings/cpp/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt index 7c1c41d..86788a8 100644 --- a/proton-c/bindings/cpp/CMakeLists.txt +++ b/proton-c/bindings/cpp/CMakeLists.txt @@ -105,13 +105,9 @@ install(TARGETS qpid-proton-cpp # Install windows qpid-proton-cpp pdb files if (MSVC) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/qpid-proton${CMAKE_DEBUG_POSTFIX}.pdb + install(FILES $<TARGET_PDB_FILE:qpid-proton-cpp> DESTINATION bin - CONFIGURATIONS Debug - OPTIONAL) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/qpid-proton.pdb - DESTINATION bin - CONFIGURATIONS RelWithDebInfo + CONFIGURATIONS RelWithDebInfo Debug OPTIONAL) endif (MSVC) @@ -138,12 +134,15 @@ set(PROTONCPPLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_SHARED_LIB set(PROTONCPPLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}) endif () +include(WriteBasicConfigVersionFile) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ProtonCppConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake @ONLY) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/ProtonCppConfigVersion.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake @ONLY) +write_basic_config_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake + VERSION ${PN_VERSION} + COMPATIBILITY AnyNewerVersion) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in ---------------------------------------------------------------------- diff --git a/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in b/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in deleted file mode 100644 index d40f5c3..0000000 --- a/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in +++ /dev/null @@ -1,30 +0,0 @@ -# This is a basic version file for the Config-mode of find_package(). -# It is used by write_basic_package_version_file() as input file for configure_file() -# to create a version-file which can be installed along a config.cmake file. -# -# The created file sets PACKAGE_VERSION_EXACT if the current version string and -# the requested version string are exactly the same and it sets -# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. - -set(PACKAGE_VERSION "@PN_VERSION@") - -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) - set(PACKAGE_VERSION_COMPATIBLE FALSE) -else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") - set(PACKAGE_VERSION_EXACT TRUE) - endif() -endif() - -# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") - return() -endif() - -# check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") - math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - set(PACKAGE_VERSION_UNSUITABLE TRUE) -endif() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/proton-c/src/ProtonConfigVersion.cmake.in ---------------------------------------------------------------------- diff --git a/proton-c/src/ProtonConfigVersion.cmake.in b/proton-c/src/ProtonConfigVersion.cmake.in deleted file mode 100644 index d40f5c3..0000000 --- a/proton-c/src/ProtonConfigVersion.cmake.in +++ /dev/null @@ -1,30 +0,0 @@ -# This is a basic version file for the Config-mode of find_package(). -# It is used by write_basic_package_version_file() as input file for configure_file() -# to create a version-file which can be installed along a config.cmake file. -# -# The created file sets PACKAGE_VERSION_EXACT if the current version string and -# the requested version string are exactly the same and it sets -# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. - -set(PACKAGE_VERSION "@PN_VERSION@") - -if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) - set(PACKAGE_VERSION_COMPATIBLE FALSE) -else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") - set(PACKAGE_VERSION_EXACT TRUE) - endif() -endif() - -# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "") - return() -endif() - -# check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT "${CMAKE_SIZEOF_VOID_P}" STREQUAL "@CMAKE_SIZEOF_VOID_P@") - math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - set(PACKAGE_VERSION_UNSUITABLE TRUE) -endif() http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/proton-c/src/tests/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/src/tests/CMakeLists.txt b/proton-c/src/tests/CMakeLists.txt index 29e3cf6..3ea8bcf 100644 --- a/proton-c/src/tests/CMakeLists.txt +++ b/proton-c/src/tests/CMakeLists.txt @@ -27,7 +27,9 @@ endif () macro (pn_add_c_test test file) add_executable (${test} ${file}) target_link_libraries (${test} qpid-proton) - pn_c_files (${file}) + if (BUILD_WITH_CXX) + set_source_files_properties (${file} PROPERTIES LANGUAGE CXX) + endif (BUILD_WITH_CXX) if (CMAKE_SYSTEM_NAME STREQUAL Windows) add_test (NAME ${test} COMMAND ${env_py} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
