Skip to content

Commit

Permalink
Configure the cmake config for downstream consumption
Browse files Browse the repository at this point in the history
- Make sure all required dependencies are also detected in downstream
  users
- Add some legacy variables
  • Loading branch information
tmadlener committed Oct 8, 2024
1 parent 659d325 commit e075940
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@ install(EXPORT ${PROJECT_NAME}Targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/"
)

gaudi_install(CMAKE cmake/${PROJECT_NAME}Config.cmake)
include(cmake/k4FWCoreCreateConfig.cmake)

gaudi_install(CMAKE ${PROJECT_BINARY_DIR}/k4FWCoreConfig.cmake)
11 changes: 0 additions & 11 deletions cmake/k4FWCoreConfig.cmake

This file was deleted.

34 changes: 34 additions & 0 deletions cmake/k4FWCoreConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
###############################################################################
# k4FWCore CMake Config
#
# Exported Targets
# - k4FWCore::k4FWCore The core library containing the PodioDataSvc
# and the KeepDropSwitch
# - k4FWCore::k4FWCorePlugins The plugin library for the core plugins
# provided by k4FWCore. Includes all major
# services for I/O and as well as some utility
# algorithms
# - k4FWCore::k4Interface The (header-only) target containing all
# interface definitions
#
###############################################################################
@PACKAGE_INIT@

set_and_check(k4FWCore_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
set_and_check(k4FWCore_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

include(CMakeFindDependencyMacro)
find_dependency(podio @podio_VERSION@)
find_dependency(Gaudi @Gaudi_VERSION@)
find_dependency(EDM4HEP @EDM4HEP_VERSION@)
find_dependency(ROOT @ROOT_VERSION@ COMPONENTS RIO Tree)

if(NOT TARGET k4FWCore::k4FWCore)
include("${CMAKE_CURRENT_LIST_DIR}/k4FWCoreTargets.cmake")
endif()

check_required_components(k4FWCore)

include(FindPackageHandleStandardArgs)
get_property(TEST_K4FWCORE_LIBRARY TARGET k4FWCore::k4FWCore PROPERTY LOCATION)
find_package_handle_standard_args(k4FWCore DEFAULT_MSG CMAKE_CURRENT_LIST_FILE TEST_K4FWCORE_LIBRARY)
6 changes: 6 additions & 0 deletions cmake/k4FWCoreCreateConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include(CMakePackageConfigHelpers)

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)

0 comments on commit e075940

Please sign in to comment.