############################################################################## # cmake configuration file for DD4hep # # returns following variables: # # DD4hep_FOUND : set to TRUE if DD4hep found # DD4hep_VERSION : package version # DD4hep_ROOT : path to this DD4hep installation # DD4hep_LIBRARIES : list of DD4hep libraries # DD4hep_INCLUDE_DIRS : list of paths to be used with INCLUDE_DIRECTORIES # DD4hep_LIBRARY_DIRS : list of paths to be used with LINK_DIRECTORIES # # @author Jan Engels, Desy ############################################################################## # Locate the DD4hep install prefix. This CMake file is installed in two # different locations (root and "cmake" subdir) that we must disambiguate. get_filename_component(_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(_lastdir "${_thisdir}" NAME) if (_lastdir STREQUAL "cmake") get_filename_component(_thisdir "${_thisdir}" PATH) endif() set ( DD4hep_DIR "${_thisdir}" ) set ( DD4hep_ROOT "${_thisdir}" ) set ( DD4hep_VERSION "@DD4hep_VERSION@" ) set ( DD4hep_SOVERSION "@DD4hep_SOVERSION@" ) set ( DD4HEP_USE_GEANT4 "@DD4HEP_USE_GEANT4@" ) set ( DD4HEP_USE_LCIO "@DD4HEP_USE_LCIO@" ) set ( DD4HEP_USE_XERCESC "@DD4HEP_USE_XERCESC@" ) set ( DD4hep_BUILD_CXX_STANDARD @CMAKE_CXX_STANDARD@ ) # figure out if including build has compatible standard set if (NOT "${CMAKE_CXX_STANDARD}" EQUAL "${DD4hep_BUILD_CXX_STANDARD}") message( SEND_ERROR "CMAKE_CXX_STANDARD is set to C++${CMAKE_CXX_STANDARD} but C++${DD4hep_BUILD_CXX_STANDARD} is required for DD4hep.") endif() # set ( GEANT4_USE_CLHEP "@GEANT4_USE_CLHEP@" ) # set ( ROOTSYS "$ENV{ROOTSYS}" ) # set ( ROOT_DIR "$ENV{ROOTSYS}/cmake" ) # set ( ROOT_VERSION "@ROOT_VERSION@" ) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${DD4hep_DIR}/cmake ) # ---------- include dirs ----------------------------------------------------- # do not store find results in cache set(DD4hep_INCLUDE_DIRS "") # ---------- default build type -------------------------------------------------------- if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "One of: None Debug Release RelWithDebInfo MinSizeRel." FORCE) endif() FIND_PACKAGE(Boost REQUIRED COMPONENTS filesystem system) SET_TARGET_PROPERTIES(Boost::boost PROPERTIES INTERFACE_COMPILE_DEFINITIONS BOOST_SPIRIT_USE_PHOENIX_V3 ) find_package(Geant4 10.2.2 REQUIRED gdml ui_all vis_all) DD4HEP_SETUP_GEANT4_TARGETS() FIND_PACKAGE(ROOT REQUIRED) DD4HEP_SETUP_ROOT_TARGETS() if(DD4HEP_USE_LCIO) find_package(LCIO REQUIRED) DD4HEP_SETUP_LCIO_TARGETS() endif() if(NOT CMAKE_PROJECT_NAME STREQUAL DD4hep) include("${DD4hep_ROOT}/cmake/DD4hepConfig-targets.cmake") endif() # ---------- include dirs ----------------------------------------------------- # do not store find results in cache GET_TARGET_PROPERTY(DD4hep_INCLUDE_DIRS DD4hep::DDCore INTERFACE_INCLUDE_DIRECTORIES) MESSAGE(STATUS "include dirs ${DD4hep_INCLUDE_DIRS}") # ---------- libraries -------------------------------------------------------- set(DD4hep_LIBRARIES DD4hep::DDCore) SET(DD4hep_COMPONENT_LIBRARIES) IF(DD4hep_FIND_COMPONENTS) dd4hep_print( "|++> DD4hep: Looking for Components: ${DD4hep_FIND_COMPONENTS}" ) FOREACH(comp ${DD4hep_FIND_COMPONENTS}) IF(NOT TARGET DD4hep::${comp}) MESSAGE(FATAL_ERROR "|++> Did not find required component: ${comp}") ENDIF() LIST(APPEND DD4hep_COMPONENT_LIBRARIES DD4hep::${comp}) ENDFOREACH() ENDIF() #---- build with xercesc or tinyxml ? if( @DD4HEP_USE_XERCESC@ ) set( DD4HEP_USE_XERCESC True ) endif() INCLUDE( ${DD4hep_DIR}/cmake/DD4hep_XML_setup.cmake ) #----- APPLE ? ------- set( USE_DYLD @USE_DYLD@ ) MARK_AS_ADVANCED( USE_DYLD ) # ---------- final checking --------------------------------------------------- INCLUDE( FindPackageHandleStandardArgs ) # set DD4HEP_FOUND to TRUE if all listed variables are TRUE and not empty FIND_PACKAGE_HANDLE_STANDARD_ARGS( DD4hep DEFAULT_MSG DD4hep_DIR DD4hep_INCLUDE_DIRS DD4hep_LIBRARIES ) SET( DD4hep_FOUND ${DD4HEP_FOUND} )