From fc022b3929314951b0ff100a64a30db97ddd415f Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 17 Aug 2023 21:16:06 +0800 Subject: [PATCH] Add project-specific prefix to REL_INSTALL_DIR to avoid conflict with downstream project's config file. --- cmake/CelixConfig.cmake | 26 +++++++++---------- documents/bundles.md | 10 +++---- libs/promises/cmake/CelixPromisesConfig.cmake | 10 +++---- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/cmake/CelixConfig.cmake b/cmake/CelixConfig.cmake index 3cef039b4..a97ccc8a2 100644 --- a/cmake/CelixConfig.cmake +++ b/cmake/CelixConfig.cmake @@ -23,12 +23,12 @@ # CELIX_LAUNCHER - The Celix launcher # relative install dir from lib/CMake/Celix. -get_filename_component(REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) -get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) -get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) +get_filename_component(CELIX_REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(CELIX_REL_INSTALL_DIR "${CELIX_REL_INSTALL_DIR}" PATH) +get_filename_component(CELIX_REL_INSTALL_DIR "${CELIX_REL_INSTALL_DIR}" PATH) +get_filename_component(CELIX_REL_INSTALL_DIR "${CELIX_REL_INSTALL_DIR}" PATH) -include("${REL_INSTALL_DIR}/share/celix/cmake/cmake_celix/UseCelix.cmake") #adds celix commands (e.g. add_celix_bundle) +include("${CELIX_REL_INSTALL_DIR}/share/celix/cmake/cmake_celix/UseCelix.cmake") #adds celix commands (e.g. add_celix_bundle) include(CMakeFindDependencyMacro) @@ -36,18 +36,18 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_dependency(Threads) #adds celix optional dependencies -include("${REL_INSTALL_DIR}/share/celix/cmake/CelixDeps.cmake") +include("${CELIX_REL_INSTALL_DIR}/share/celix/cmake/CelixDeps.cmake") #imports lib and exe targets (e.g. Celix::framework) -include("${REL_INSTALL_DIR}/share/celix/cmake/Targets.cmake") -include("${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake") +include("${CELIX_REL_INSTALL_DIR}/share/celix/cmake/Targets.cmake") +include("${CELIX_REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake") # The rest is added to ensure backwards compatiblity with project using the cmake lib/include var instead of targets. -set(CELIX_CMAKE_MODULES_DIR ${REL_INSTALL_DIR}/share/celix/cmake/Modules) +set(CELIX_CMAKE_MODULES_DIR ${CELIX_REL_INSTALL_DIR}/share/celix/cmake/Modules) -set(CELIX_FRAMEWORK_INCLUDE_DIR "${REL_INSTALL_DIR}/include/celix") -set(CELIX_UTILS_INCLUDE_DIR "${REL_INSTALL_DIR}/include/utils") -set(CELIX_DFI_INCLUDE_DIR "${REL_INSTALL_DIR}/include/dfi") +set(CELIX_FRAMEWORK_INCLUDE_DIR "${CELIX_REL_INSTALL_DIR}/include/celix") +set(CELIX_UTILS_INCLUDE_DIR "${CELIX_REL_INSTALL_DIR}/include/utils") +set(CELIX_DFI_INCLUDE_DIR "${CELIX_REL_INSTALL_DIR}/include/dfi") set(CELIX_LIBRARIES Celix::framework Celix::utils Celix::dfi) set(CELIX_INCLUDE_DIRS @@ -79,6 +79,6 @@ if (TARGET Celix::dependency_manager_cxx) set(CELIX_DM_CXX_STATIC_LIB $) endif () -set(CELIX_BUNDLES_DIR ${REL_INSTALL_DIR}/share/celix/bundles) +set(CELIX_BUNDLES_DIR ${CELIX_REL_INSTALL_DIR}/share/celix/bundles) set(CELIX_SHELL_BUNDLE ${CELIX_BUNDLES_DIR}/shell.zip) set(CELIX_SHELL_TUI_BUNDLE ${CELIX_BUNDLES_DIR}/shell_tui.zip) \ No newline at end of file diff --git a/documents/bundles.md b/documents/bundles.md index b68e41421..4de6e64c0 100644 --- a/documents/bundles.md +++ b/documents/bundles.md @@ -302,11 +302,11 @@ install_celix_targets(MyExport NAMESPACE ExamplePackage:: DESTINATION share/Exam #Install Package CMake configuration file(GENERATE OUTPUT ${CMAKE_BINARY_DIR}/ExamplePackageConfig.cmake CONTENT " # relative install dir from lib/CMake/ExamplePackage. - get_filename_component(REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) - get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) - get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) - include(${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake) + get_filename_component(EXAMPLE_PACKAGE_REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) + get_filename_component(EXAMPLE_PACKAGE_REL_INSTALL_DIR "${EXAMPLE_PACKAGE_REL_INSTALL_DIR}" PATH) + get_filename_component(EXAMPLE_PACKAGE_REL_INSTALL_DIR "${EXAMPLE_PACKAGE_REL_INSTALL_DIR}" PATH) + get_filename_component(EXAMPLE_PACKAGE_REL_INSTALL_DIR "${EXAMPLE_PACKAGE_REL_INSTALL_DIR}" PATH) + include(${EXAMPLE_PACKAGE_REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake) ") install(FILES diff --git a/libs/promises/cmake/CelixPromisesConfig.cmake b/libs/promises/cmake/CelixPromisesConfig.cmake index 571ca9534..210065b11 100644 --- a/libs/promises/cmake/CelixPromisesConfig.cmake +++ b/libs/promises/cmake/CelixPromisesConfig.cmake @@ -20,9 +20,9 @@ # Celix::Promise CMake imported target # relative install dir from lib/CMake/CelixPromise. -get_filename_component(REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) -get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) -get_filename_component(REL_INSTALL_DIR "${REL_INSTALL_DIR}" PATH) +get_filename_component(CELIX_PROMISES_REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(CELIX_PROMISES_REL_INSTALL_DIR "${CELIX_PROMISES_REL_INSTALL_DIR}" PATH) +get_filename_component(CELIX_PROMISES_REL_INSTALL_DIR "${CELIX_PROMISES_REL_INSTALL_DIR}" PATH) +get_filename_component(CELIX_PROMISES_REL_INSTALL_DIR "${CELIX_PROMISES_REL_INSTALL_DIR}" PATH) -include("${REL_INSTALL_DIR}/share/CelixPromises/cmake/Targets.cmake") #imports lib and exe targets (e.g. Celix::framework) \ No newline at end of file +include("${CELIX_PROMISES_REL_INSTALL_DIR}/share/CelixPromises/cmake/Targets.cmake") #imports lib and exe targets (e.g. Celix::framework) \ No newline at end of file