CELIX-417: Some cleanup for the CelixConfig.cmake file
Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/481e7985 Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/481e7985 Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/481e7985 Branch: refs/heads/develop Commit: 481e79850d21e8dcecf9f880158b4054fd3ded73 Parents: 83d77f4 Author: Pepijn Noltes <[email protected]> Authored: Tue Jan 30 20:26:12 2018 +0100 Committer: Pepijn Noltes <[email protected]> Committed: Tue Jan 30 20:26:12 2018 +0100 ---------------------------------------------------------------------- cmake/CelixConfig.cmake | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/481e7985/cmake/CelixConfig.cmake ---------------------------------------------------------------------- diff --git a/cmake/CelixConfig.cmake b/cmake/CelixConfig.cmake index c2d73d7..364b856 100644 --- a/cmake/CelixConfig.cmake +++ b/cmake/CelixConfig.cmake @@ -22,22 +22,23 @@ # CELIX_LIBRARIES - libraries to link against # CELIX_LAUNCHER - The Celix launcher -set(REL_INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/../../..") #from lib/Cmake/Celix +# 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) +include("${REL_INSTALL_DIR}/share/celix/cmake/cmake_celix/UseCelix.cmake") #adds celix commands (e.g. add_celix_bundle) +include("${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake") #imports lib and exe targets (e.g. Celix::framework) +include("${REL_INSTALL_DIR}/share/celix/cmake/CelixBundleTargets.cmake") #imports bundle targets (e.g. Celix::shell) + +# 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_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") -include("${REL_INSTALL_DIR}/share/celix/cmake/cmake_celix/UseCelix.cmake") - -if(NOT TARGET Celix::framework) - include("${REL_INSTALL_DIR}/share/celix/cmake/CelixTargets.cmake") - include("${REL_INSTALL_DIR}/share/celix/cmake/CelixBundleTargets.cmake") -endif() - - -# The rest is added to ensure backwards compatiblity with project using the cmake lib/include var instead of targets. set(CELIX_LIBRARIES Celix::framework Celix::utils Celix::dfi) set(CELIX_INCLUDE_DIRS $<TARGET_PROPERTY:Celix::framework,INTERFACE_INCLUDE_DIRECTORIES> @@ -68,4 +69,4 @@ endif () set(CELIX_BUNDLES_DIR ${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 +set(CELIX_SHELL_TUI_BUNDLE ${CELIX_BUNDLES_DIR}/shell_tui.zip)
