CMake configuration file, to link DD4hep from other libraries.
Also requires that DD4hepCore library is installed in ${CMAKE_INSTALL_PREFIX}/lib, which requires a change in the two CMAKELists.txt (base and DDCore)

###############################################
# cmake configuration file for DD4hep
# @author Andre Sailer, CERN
###############################################

SET( DD4hep_FOUND FALSE )
MARK_AS_ADVANCED( DD4hep_FOUND )

# do not store find results in cache
SET( DDCore_INCLUDE_DIR DDCore_INCLUDE_DIR-NOTFOUND )

FIND_PATH( DDCore_INCLUDE_DIR
  NAMES LCDD.h
  PATHS ${DD4hep_DIR}
  PATH_SUFFIXES DDCore/include/DD4hep
  NO_DEFAULT_PATH
  )

IF( NOT DDCore_INCLUDE_DIR )
  MESSAGE( STATUS "Check for DDCore: ${DDCore_DIR}" " -- failed to find DDCore include directory!!" )
ELSE( NOT DDCore_INCLUDE_DIR )
  MARK_AS_ADVANCED( DDCore_INCLUDE_DIR )
ENDIF( NOT DDCore_INCLUDE_DIR )


# do not store find results in cache
SET( DD4hep_LIB DD4hep_LIB-NOTFOUND )

FIND_LIBRARY( DD4hep_LIB
  NAMES DD4hepCore
  PATHS ${DD4hep_DIR}
  PATH_SUFFIXES lib
  NO_DEFAULT_PATH
  )

IF( NOT DD4hep_LIB )
  MESSAGE( STATUS "Check for DD4hep: ${DD4hep_DIR}"
    " -- failed to find DD4hep library!!" )
ENDIF( NOT DD4hep_LIB )


# set variables and display results
IF( DDCore_INCLUDE_DIR AND DD4hep_LIB )
  SET( DD4hep_FOUND TRUE )
  SET( DD4hep_INCLUDE_DIRS ${DDCore_INCLUDE_DIR} )
  SET( DD4hep_LIBRARIES ${DD4hep_LIB} )
  MARK_AS_ADVANCED( DD4hep_INCLUDE_DIRS DD4hep_LIBRARIES )
  MESSAGE( STATUS "Check for DD4hep: ${DD4hep_DIR} -- works" )
ELSE( DDCore_INCLUDE_DIR AND DD4hep_LIB )
  IF( DD4hep_FIND_REQUIRED )
    MESSAGE( FATAL_ERROR "Check for DD4hep: ${DD4hep_DIR} -- failed!!" )
  ELSE( DD4hep_FIND_REQUIRED )
    MESSAGE( STATUS "Check for DD4hep: ${DD4hep_DIR}"
      " -- failed!! will skip this package..." )
  ENDIF( DD4hep_FIND_REQUIRED )
ENDIF( DD4hep_INCLUDE_DIR AND DD4hep_LIB )
  • No labels