diff --git a/CMakeLists.txt b/CMakeLists.txt index 88375707..1dd78959 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,13 +65,4 @@ if(ENABLE_CPACK) include(cmake/${PROJECT_NAME}CPack.cmake) endif() - -install(EXPORT ${PROJECT_NAME}Targets - NAMESPACE ${PROJECT_NAME}:: - FILE "${PROJECT_NAME}Targets.cmake" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/" - ) - include(cmake/k4FWCoreCreateConfig.cmake) - -gaudi_install(CMAKE ${PROJECT_BINARY_DIR}/k4FWCoreConfig.cmake) diff --git a/cmake/k4FWCoreCreateConfig.cmake b/cmake/k4FWCoreCreateConfig.cmake index a80ae942..4f027e44 100644 --- a/cmake/k4FWCoreCreateConfig.cmake +++ b/cmake/k4FWCoreCreateConfig.cmake @@ -1,6 +1,22 @@ include(CMakePackageConfigHelpers) +# Version file is same wherever we are +write_basic_package_version_file(${PROJECT_BINARY_DIR}/k4FWCoreConfigVersion.cmake + VERSION ${k4FWCore_VERSION} + COMPATIBILITY SameMajorVersion) + + configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/k4FWCoreConfig.cmake.in ${PROJECT_BINARY_DIR}/k4FWCoreConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/k4FWCore PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/k4FWCoreConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/k4FWCoreConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) + +install(EXPORT ${PROJECT_NAME}Targets + NAMESPACE ${PROJECT_NAME}:: + FILE "${PROJECT_NAME}Targets.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/" +)