From da6370ed3f27c83d3ffa679fff26086949e32ed0 Mon Sep 17 00:00:00 2001 From: Casey Waldren Date: Mon, 7 Oct 2024 16:07:00 -0700 Subject: [PATCH] fix exports name --- CMakeLists.txt | 22 +++++++++++++------ cmake/rfc3339_timestamp.cmake | 2 +- libs/client-sdk/src/CMakeLists.txt | 4 ++-- libs/common/src/CMakeLists.txt | 2 +- libs/internal/src/CMakeLists.txt | 2 +- .../src/CMakeLists.txt | 2 +- libs/server-sdk/src/CMakeLists.txt | 3 +-- libs/server-sent-events/src/CMakeLists.txt | 2 +- vendor/foxy/CMakeLists.txt | 2 +- vendor/foxy/cmake/certify.cmake | 2 +- 10 files changed, 25 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4f434174..000892d46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,13 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(LD_TARGETS_EXPORT_NAME ${PROJECT_NAME}Targets) +set(LD_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +set(LD_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}") +set(LD_CMAKE_PROJECT_CONFIG_FILE "${LD_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake") +set(LD_CMAKE_VERSION_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake") + + if (LD_BUILD_UNIT_TESTS) message(STATUS "LaunchDarkly: building unit tests") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG") @@ -192,18 +199,19 @@ include(CMakePackageConfigHelpers) include(GNUInstallDirs) write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake" + ${LD_CMAKE_VERSION_CONFIG_FILE} COMPATIBILITY SameMajorVersion ) install(FILES - "${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_PROJECT_NAME}Config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake" - DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${CMAKE_PROJECT_NAME}" + ${LD_CMAKE_PROJECT_CONFIG_FILE} + ${LD_CMAKE_VERSION_CONFIG_FILE} + DESTINATION ${LD_CONFIG_INSTALL_DIR} ) + install( - EXPORT "${PROJECT_NAME}Targets" - NAMESPACE "${PROJECT_NAME}::" - DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/${CMAKE_PROJECT_NAME}" + EXPORT ${LD_TARGETS_EXPORT_NAME} + NAMESPACE ${PROJECT_NAME}:: + DESTINATION ${LD_CONFIG_INSTALL_DIR} ) diff --git a/cmake/rfc3339_timestamp.cmake b/cmake/rfc3339_timestamp.cmake index 82c3337ee..2416875a2 100644 --- a/cmake/rfc3339_timestamp.cmake +++ b/cmake/rfc3339_timestamp.cmake @@ -27,5 +27,5 @@ target_include_directories(timestamp PUBLIC ) install( TARGETS timestamp - EXPORT "${PROJECT_NAME}Targets" + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/libs/client-sdk/src/CMakeLists.txt b/libs/client-sdk/src/CMakeLists.txt index 4b6f68409..1b7660689 100644 --- a/libs/client-sdk/src/CMakeLists.txt +++ b/libs/client-sdk/src/CMakeLists.txt @@ -68,6 +68,6 @@ install(DIRECTORY "${LaunchDarklyCPPClient_SOURCE_DIR}/include/launchdarkly" ) install( - TARGETS ${LIBNAME} OPTIONAL - EXPORT "${PROJECT_NAME}Targets" + TARGETS ${LIBNAME} + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/libs/common/src/CMakeLists.txt b/libs/common/src/CMakeLists.txt index 8c1987dae..cc5c17c98 100644 --- a/libs/common/src/CMakeLists.txt +++ b/libs/common/src/CMakeLists.txt @@ -90,5 +90,5 @@ target_compile_features(${LIBNAME} PUBLIC cxx_std_17) install( TARGETS ${LIBNAME} - EXPORT "${PROJECT_NAME}Targets" + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/libs/internal/src/CMakeLists.txt b/libs/internal/src/CMakeLists.txt index 675bcdba2..af1bd209e 100644 --- a/libs/internal/src/CMakeLists.txt +++ b/libs/internal/src/CMakeLists.txt @@ -74,5 +74,5 @@ target_compile_features(${LIBNAME} PUBLIC cxx_std_17) install( TARGETS ${LIBNAME} - EXPORT "${PROJECT_NAME}Targets" + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/libs/server-sdk-redis-source/src/CMakeLists.txt b/libs/server-sdk-redis-source/src/CMakeLists.txt index c77924384..c7c545822 100644 --- a/libs/server-sdk-redis-source/src/CMakeLists.txt +++ b/libs/server-sdk-redis-source/src/CMakeLists.txt @@ -51,5 +51,5 @@ target_compile_features(${LIBNAME} PUBLIC cxx_std_17) install( TARGETS ${LIBNAME} OPTIONAL - EXPORT "${PROJECT_NAME}Targets" + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/libs/server-sdk/src/CMakeLists.txt b/libs/server-sdk/src/CMakeLists.txt index cf6af71e6..7b93be27f 100644 --- a/libs/server-sdk/src/CMakeLists.txt +++ b/libs/server-sdk/src/CMakeLists.txt @@ -102,6 +102,5 @@ target_compile_features(${LIBNAME} PUBLIC cxx_std_17) install( TARGETS ${LIBNAME} OPTIONAL - EXPORT "${PROJECT_NAME}Targets" - + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/libs/server-sent-events/src/CMakeLists.txt b/libs/server-sent-events/src/CMakeLists.txt index 6835fd676..22816de8b 100644 --- a/libs/server-sent-events/src/CMakeLists.txt +++ b/libs/server-sent-events/src/CMakeLists.txt @@ -33,5 +33,5 @@ target_compile_features(${LIBNAME} PUBLIC cxx_std_17) install( TARGETS ${LIBNAME} - EXPORT "${PROJECT_NAME}Targets" + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/vendor/foxy/CMakeLists.txt b/vendor/foxy/CMakeLists.txt index 7e7252fd0..a64f767c1 100644 --- a/vendor/foxy/CMakeLists.txt +++ b/vendor/foxy/CMakeLists.txt @@ -259,5 +259,5 @@ endif () install( TARGETS foxy - EXPORT "${PROJECT_NAME}Targets" + EXPORT ${LD_TARGETS_EXPORT_NAME} ) diff --git a/vendor/foxy/cmake/certify.cmake b/vendor/foxy/cmake/certify.cmake index d1610f0fc..0618d30b6 100644 --- a/vendor/foxy/cmake/certify.cmake +++ b/vendor/foxy/cmake/certify.cmake @@ -23,5 +23,5 @@ set(BUILD_TESTING ${PREVIOUS_BUILD_TESTING}) install( TARGETS core - EXPORT "${PROJECT_NAME}Targets" + EXPORT ${LD_TARGETS_EXPORT_NAME} )