Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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)
Expand Down Expand Up @@ -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}
Expand Down
24 changes: 11 additions & 13 deletions cpp/ProtonCppConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)