From b285cce943418ad156f6ff2d4a288957e32fd99d Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Thu, 22 Aug 2024 20:28:09 +0200 Subject: [PATCH] Make sure that LCIO target is also available downstream (#59) * Make sure that LCIO target is also available downstream * Remove deprecated CMake variables for LCIO --- CMakeLists.txt | 4 ++-- cmake/MarlinConfig.cmake.in | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0643947c..5cfacbf4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,8 @@ endif() FIND_PACKAGE( GEAR REQUIRED ) # export Marlin_DEPENDS_INCLUDE_DIRS to MarlinConfig.cmake -SET( Marlin_DEPENDS_INCLUDE_DIRS ${LCIO_INCLUDE_DIRS} ${GEAR_INCLUDE_DIRS} ${streamlog_INCLUDE_DIRS} ) -SET( Marlin_DEPENDS_LIBRARY_DIRS ${LCIO_LIBRARY_DIRS} ${GEAR_LIBRARY_DIRS} ${streamlog_LIBRARY_DIRS} ) +SET( Marlin_DEPENDS_INCLUDE_DIRS ${GEAR_INCLUDE_DIRS} ${streamlog_INCLUDE_DIRS} ) +SET( Marlin_DEPENDS_LIBRARY_DIRS ${GEAR_LIBRARY_DIRS} ${streamlog_LIBRARY_DIRS} ) SET( Marlin_DEPENDS_LIBRARIES LCIO::lcio ${GEAR_LIBRARIES} ${streamlog_LIBRARIES} ) INCLUDE_DIRECTORIES( SYSTEM ${Marlin_DEPENDS_INCLUDE_DIRS} ) diff --git a/cmake/MarlinConfig.cmake.in b/cmake/MarlinConfig.cmake.in index 5615c981..18148404 100644 --- a/cmake/MarlinConfig.cmake.in +++ b/cmake/MarlinConfig.cmake.in @@ -53,6 +53,19 @@ CHECK_PACKAGE_LIBS( Marlin Marlin MarlinXML ) # ---------- dependencies ----------------------------------------------------- +include(CMakeFindDependencyMacro) +find_dependency(LCIO) +if(NOT TARGET LCIO::lcio) + message(STATUS "LCIO found without targets, bootstrapping them") + add_library(LCIO::lcio INTERFACE IMPORTED GLOBAL) + set_target_properties(LCIO::lcio + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LCIO_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${LCIO_LIBRARIES}" + ) +endif() + + INCLUDE( "@ILCSOFT_CMAKE_MODULES_ROOT@/MacroExportPackageDeps.cmake" ) # exports following package dependencies (if set) # first argument of macro should be the package name