diff --git a/Analysis/TotalInvMass/CMakeLists.txt b/Analysis/TotalInvMass/CMakeLists.txt index 1f0acbd8ad900498c7070a63360c043786f117b6..6aaf10b657fa4084d11f59baa2cab0ae91e1c17c 100644 --- a/Analysis/TotalInvMass/CMakeLists.txt +++ b/Analysis/TotalInvMass/CMakeLists.txt @@ -18,3 +18,9 @@ gaudi_add_module(TotalInvMass EDM4HEP::edm4hep EDM4HEP::edm4hepDict ${ROOT_LIBRARIES} ) + +install(TARGETS TotalInvMass + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev) diff --git a/CMakeLists.txt b/CMakeLists.txt index 860eaf8517848fc1abc06df56817d44c96103e04..bf890d89c41df09caa4bd3ad4e4c50d7bf59e4bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,15 @@ find_package(ROOT COMPONENTS RIO Tree) find_package(Gaudi) + +include(GNUInstallDirs) +include(CTest) + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/InstallArea/ CACHE PATH + "Install path prefix, prepended onto install directories." FORCE ) +endif() + # Set up C++ Standard # ``-DCMAKE_CXX_STANDARD=<standard>`` when invoking CMake set(CMAKE_CXX_STANDARD 17 CACHE STRING "") @@ -16,3 +25,15 @@ endif() add_subdirectory(Analysis) add_subdirectory(Detector) + +############################################################################## +# INSTALL +############################################################################## + +install(EXPORT ${PROJECT_NAME}Targets + NAMESPACE ${PROJECT_NAME}:: + FILE "${PROJECT_NAME}Targets.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/" + ) + +gaudi_install(CMAKE cmake/${PROJECT_NAME}Config.cmake) diff --git a/Detector/CMakeLists.txt b/Detector/CMakeLists.txt index 54c2d5459f753beecac1b22c21385d9b6c38cd85..3e8c3f6ebb21d36f41932496694c4e227ebba188 100644 --- a/Detector/CMakeLists.txt +++ b/Detector/CMakeLists.txt @@ -5,4 +5,4 @@ # add_subdirectory(DetEcalMatrix) add_subdirectory(DetInterface) # add_subdirectory(DetSegmentation) -# add_subdirectory(GeomSvc) +add_subdirectory(GeomSvc) diff --git a/Detector/GeomSvc/CMakeLists.txt b/Detector/GeomSvc/CMakeLists.txt index 58c69f7eaec67c8f136f0b002aa676dc5ed84fb1..a4b10c8b08b30198e991e0a5462ba26e27067a3c 100644 --- a/Detector/GeomSvc/CMakeLists.txt +++ b/Detector/GeomSvc/CMakeLists.txt @@ -4,31 +4,22 @@ # Desc: implement the IGeomSvc interface. ############################################################################## -gaudi_subdir(GeomSvc v0r0) - -gaudi_depends_on_subdirs( - k4FWCore - Detector/DetInterface -) - find_package(ROOT COMPONENTS MathCore GenVector Geom Tree) find_package(DD4hep COMPONENTS DDG4 DDRec REQUIRED) find_package(GEAR REQUIRED) -message("GEAR_LIBRARIES: ${GEAR_LIBRARIES}") - gaudi_add_module(GeomSvc - src/GeomSvc.cpp - INCLUDE_DIRS - # DetInterface - # DD4hep - # GaudiKernel - # ROOT - LINK_LIBRARIES - DD4hep + SOURCES src/GeomSvc.cpp + LINK + DetInterface ${DD4hep_COMPONENT_LIBRARIES} - GaudiKernel + Gaudi::GaudiKernel ${GEAR_LIBRARIES} ${ROOT_LIBRARIES} - # ROOT ) + +install(TARGETS GeomSvc + EXPORT CEPCSWTargets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + COMPONENT dev)