You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by jd...@apache.org on 2021/08/13 15:14:58 UTC
[qpid-proton] branch main updated: PROTON-2254 Update proton-cpp
CMake install to also use new features (#330)
This is an automated email from the ASF dual-hosted git repository.
jdanek pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new 870af4d PROTON-2254 Update proton-cpp CMake install to also use new features (#330)
870af4d is described below
commit 870af4dfb54589159b732aa20245aae37d017152
Author: Jiri Daněk <jd...@redhat.com>
AuthorDate: Fri Aug 13 17:14:51 2021 +0200
PROTON-2254 Update proton-cpp CMake install to also use new features (#330)
---
cpp/CMakeLists.txt | 34 +++++++++++++++++++++++++++++-----
cpp/ProtonCppConfig.cmake.in | 24 +++++++++++-------------
2 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index eba042e..5773234 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -113,7 +113,10 @@ if(BUILD_STATIC_LIBS)
target_compile_definitions(qpid-proton-cpp-static
PRIVATE PROTON_DECLARE_STATIC
PUBLIC PN_CPP_DECLARE_STATIC)
- set(STATIC_LIBS qpid-proton-cpp-static)
+ set_target_properties (
+ qpid-proton-cpp-static
+ PROPERTIES
+ EXPORT_NAME cpp)
endif(BUILD_STATIC_LIBS)
target_link_libraries (qpid-proton-cpp LINK_PRIVATE ${PLATFORM_LIBS} qpid-proton-core qpid-proton-proactor ${CONNECT_CONFIG_LIBS})
@@ -126,15 +129,23 @@ set_target_properties (
SOVERSION "${PN_LIB_CPP_MAJOR_VERSION}"
LINK_FLAGS "${CATCH_UNDEFINED} ${LINK_LTO}"
COMPILE_FLAGS "${LTO}"
+ EXPORT_NAME cpp
)
## Install
-install(TARGETS qpid-proton-cpp ${STATIC_LIBS}
- EXPORT proton-cpp
+install(TARGETS qpid-proton-cpp
+ EXPORT ProtonCppTargets
RUNTIME DESTINATION bin
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR})
+if (BUILD_STATIC_LIBS)
+ install(TARGETS qpid-proton-cpp-static
+ EXPORT ProtonCppStaticTargets
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR})
+endif ()
# Install windows qpid-proton-cpp pdb files
if (MSVC)
@@ -172,11 +183,24 @@ install (FILES
${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton-cpp.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+install(EXPORT ProtonCppTargets
+ FILE ProtonCppTargets.cmake
+ NAMESPACE Proton::
+ DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
+if (BUILD_STATIC_LIBS)
+ install(EXPORT ProtonCppStaticTargets
+ FILE ProtonCppTargets.cmake
+ NAMESPACE Proton::
+ DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
+endif ()
+
+include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)
-configure_file(
+configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/ProtonCppConfig.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake @ONLY)
+ ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake
+ INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
write_basic_config_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake
VERSION ${PN_VERSION}
diff --git a/cpp/ProtonCppConfig.cmake.in b/cpp/ProtonCppConfig.cmake.in
index 2bc08f6..e869170 100644
--- a/cpp/ProtonCppConfig.cmake.in
+++ b/cpp/ProtonCppConfig.cmake.in
@@ -22,19 +22,17 @@
# Version: @PN_VERSION@
# URL: http://qpid.apache.org/proton/
-set (ProtonCpp_VERSION @PN_VERSION@)
-
-set (ProtonCpp_INCLUDE_DIRS @INCLUDEDIR@)
-set (ProtonCpp_LIBRARIES optimized @LIBDIR@/@PROTONCPPLIB@ debug @LIBDIR@/@PROTONCPPLIBDEBUG@)
-
-if (NOT TARGET Proton::cpp)
- # Sigh.. have to make this compat with cmake 2.8.12
- add_library(Proton::cpp UNKNOWN IMPORTED)
- set_target_properties(Proton::cpp
- PROPERTIES
- IMPORTED_LOCATION "@LIBDIR@/@PROTONCPPLIB@"
- IMPORTED_LOCATION_DEBUG "@LIBDIR@/@PROTONCPPLIBDEBUG@"
- INTERFACE_INCLUDE_DIRECTORIES "${ProtonCpp_INCLUDE_DIRS}")
+@PACKAGE_INIT@
+if (NOT ProtonCpp_USE_STATIC_LIBS)
+ include("${CMAKE_CURRENT_LIST_DIR}/ProtonCppTargets.cmake")
+else()
+ include("${CMAKE_CURRENT_LIST_DIR}/ProtonCppTargetsStatic.cmake")
endif()
+set (ProtonCpp_VERSION @PN_VERSION@)
+
+set (ProtonCpp_INCLUDE_DIRS @INCLUDEDIR@)
+set (ProtonCpp_LIBRARIES Proton::cpp)
set (ProtonCpp_FOUND True)
+
+check_required_components(ProtonCpp)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org