Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QPID-7148: Use more modern CMake install machinery for better QpidConfig.cmake #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
32 changes: 25 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ set_target_properties (qpidcommon PROPERTIES
SOVERSION ${qpidcommon_version_major})

install (TARGETS qpidcommon
EXPORT QpidTargets
RUNTIME DESTINATION ${QPID_INSTALL_BINDIR} COMPONENT ${QPID_COMPONENT_COMMON}
LIBRARY DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_COMMON}
ARCHIVE DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_COMMON})
Expand All @@ -880,6 +881,7 @@ set_target_properties (qpidtypes PROPERTIES
SOVERSION ${qpidtypes_version_major})

install(TARGETS qpidtypes
EXPORT QpidTargets
RUNTIME DESTINATION ${QPID_INSTALL_BINDIR} COMPONENT ${QPID_COMPONENT_COMMON}
LIBRARY DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_COMMON}
ARCHIVE DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_COMMON})
Expand Down Expand Up @@ -939,6 +941,7 @@ set_target_properties (qpidclient PROPERTIES
SOVERSION ${qpidclient_version_major})

install (TARGETS qpidclient
EXPORT QpidTargets
RUNTIME DESTINATION ${QPID_INSTALL_BINDIR} COMPONENT ${QPID_COMPONENT_CLIENT}
LIBRARY DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_CLIENT}
ARCHIVE DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_CLIENT})
Expand Down Expand Up @@ -1006,6 +1009,7 @@ set_target_properties (qpidmessaging PROPERTIES
VERSION ${qpidmessaging_version}
SOVERSION ${qpidmessaging_version_major})
install (TARGETS qpidmessaging
EXPORT QpidTargets
RUNTIME DESTINATION ${QPID_INSTALL_BINDIR} COMPONENT ${QPID_COMPONENT_CLIENT}
LIBRARY DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_CLIENT}
ARCHIVE DESTINATION ${QPID_INSTALL_LIBDIR} COMPONENT ${QPID_COMPONENT_CLIENT})
Expand Down Expand Up @@ -1311,11 +1315,25 @@ set(QPIDTYPESLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpidtypes${CMAKE_SHARED_LIBRARY_S
set(QPIDTYPESLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpidtypes${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
endif ()

configure_file(QpidConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/QpidConfig.cmake @ONLY)
configure_file(QpidConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/QpidConfigVersion.cmake @ONLY)
install(EXPORT QpidTargets
FILE QpidTargets.cmake
NAMESPACE Qpid::
DESTINATION ${QPID_INSTALL_LIBDIR}/cmake/Qpid)

include(CMakePackageConfigHelpers)
include(WriteBasicConfigVersionFile)

configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/QpidConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/QpidConfig.cmake
PATH_VARS includedir
INSTALL_DESTINATION ${QPID_INSTALL_LIBDIR}/cmake/Qpid)
write_basic_config_version_file(
${CMAKE_CURRENT_BINARY_DIR}/QpidConfigVersion.cmake
VERSION ${VERSION}
COMPATIBILITY AnyNewerVersion)
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/QpidConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/QpidConfigVersion.cmake
DESTINATION ${QPID_INSTALL_LIBDIR}/cmake/Qpid
COMPONENT ${QPID_COMPONENT_COMMON})

${CMAKE_CURRENT_BINARY_DIR}/QpidConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/QpidConfigVersion.cmake
DESTINATION ${QPID_INSTALL_LIBDIR}/cmake/Qpid
COMPONENT ${QPID_COMPONENT_COMMON})
12 changes: 8 additions & 4 deletions src/QpidConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@
# Version: @VERSION@
# URL: http://qpid.apache.org/

set (Qpid_VERSION @VERSION@)
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/QpidTargets.cmake")

set (Qpid_INCLUDE_DIRS @includedir@)
set (Qpid_LIBRARIES optimized @libdir@/@QPIDMSGLIB@ @libdir@/@QPIDTYPESLIB@ debug @libdir@/@QPIDMSGLIBDEBUG@ @libdir@/@QPIDTYPESLIBDEBUG@)
set(Qpid_VERSION @VERSION@)

set_and_check (Qpid_INCLUDE_DIRS @PACKAGE_includedir@)
set (Qpid_LIBRARIES Qpid::qpidmessaging Qpid::qpidtypes)

# Can't make this compatible with CMake 2.8.12 as Qpid::qpid really is an interface target
# (because it has multiple libraries). So only allow for later versions of CMake
# (because it has multiple libraries). So only allow for later versions of CMake
if (NOT TARGET Qpid::qpid AND CMAKE_VERSION VERSION_GREATER "3.0")
add_library(Qpid::qpid INTERFACE IMPORTED)
target_link_libraries(Qpid::qpid INTERFACE ${Qpid_LIBRARIES})
target_include_directories(Qpid::qpid INTERFACE ${Qpid_INCLUDE_DIRS})
endif()

set (Qpid_FOUND True)
check_required_components(Qpid)
30 changes: 0 additions & 30 deletions src/QpidConfigVersion.cmake.in

This file was deleted.