diff --git a/CMakeLists.txt b/CMakeLists.txt index 48c55c05ccf0e8ceaed2b01d64c40928e219f8e3..498eec13ba2e3bd26b74698dd255f3b971ebd0dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,19 +66,16 @@ IF( INSTALL_DOC ) ENDIF() -#------ allow to use a pre-built DDSegmentation ---------------------------- -find_package(DDSegmentation QUIET) -#if it does not exist, simply build DDSegmentation as part of DD4hep: +#---Packages------------------------------------------------------------------------ + +#------ allow to use a pre-built DDSegmentation ---------------------------- +find_package( DDSegmentation QUIET ) if( NOT DDSegmentation_FOUND ) add_subdirectory(DDSegmentation) - SET( DDSegmentation_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/DDSegmentation/include) - SET( DDSegmentation_LIBRARIES DDSegmentation) endif() -#---Packages------------------------------------------------------------------------ - add_subdirectory(DDCore) add_subdirectory(DDSurfaces) add_subdirectory(DDRec) diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index 459c38812c83a5db4d7a7bb86a403ff0ddd90f3a..f1374bcfde5ee734acbd59b43a0a17645f049d79 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) project(DDCore) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR} ${DDSegmentation_INCLUDE_DIR} ) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR} ${DDSegmentation_INCLUDE_DIRS} ) file(GLOB sources src/*.cpp src/Evaluator/*.cpp src/XML/*.cpp) @@ -13,8 +13,8 @@ if(DD4HEP_USE_BOOST) #fg: canonical way of finding Boost w/ cmake uses # -D Boost_DIR=_path_to_boost # and then FindBoost.cmake sets the variable Boost_INCLUDE_DIR - FIND_PACKAGE( Boost REQUIRED) - include_directories( ${Boost_INCLUDE_DIR}) + FIND_PACKAGE( Boost REQUIRED ) + include_directories( ${Boost_INCLUDE_DIRS} ) #list(APPEND include_directories ${BOOST_INCLUDE_DIR}) file(GLOB parser_sources src/parsers/*.cpp ) add_definitions(-DDD4HEP_USE_BOOST) @@ -22,16 +22,10 @@ else() file(GLOB parser_sources ) endif() -## Find the DDSegmentation libraries -#find_library(DDSegmentation_LIBS -# NAMES ${DDSegmentation_LIBRARIES} -# PATHS ${DDSegmentation_LIBRARY_DIR} -#) - file(GLOB headers include/DD4hep/*.h) file(GLOB internal_headers include/DD4hep/objects/*.h) -list(APPEND headers ${DDSegmentation_INCLUDE_DIR}/DDSegmentation/BitField64.h) -list(APPEND headers ${DDSegmentation_INCLUDE_DIR}/DDSegmentation/Segmentation.h) +list(APPEND headers ${DDSegmentation_INCLUDE_DIRS}/DDSegmentation/BitField64.h) +list(APPEND headers ${DDSegmentation_INCLUDE_DIRS}/DDSegmentation/Segmentation.h) list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/include/DD4hep/DetFactoryHelper.h ${CMAKE_CURRENT_SOURCE_DIR}/include/DD4hep/Factories.h ${CMAKE_CURRENT_SOURCE_DIR}/include/DD4hep/Plugins.h diff --git a/DDRec/CMakeLists.txt b/DDRec/CMakeLists.txt index 8800bd0bf7c7fdfc71bbb04ea70e5d30c14b295d..e8dc9e11c33c4e0622db354526f6f5c4f83e949a 100644 --- a/DDRec/CMakeLists.txt +++ b/DDRec/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR) project(DDRec) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include - ${DDSegmentation_INCLUDE_DIR} + ${DDSegmentation_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/DDSurfaces/include ${CMAKE_SOURCE_DIR}/DDCore/include) @@ -26,12 +26,6 @@ endif() add_library(DD4hepRec SHARED ${sources} ) -## Find the DDSegmentation libraries -#find_library(DDSegmentation_LIBS -# NAMES ${DDSegmentation_LIBRARIES} -# PATHS ${DDSegmentation_LIBRARY_DIR} -#) - if(DD4HEP_WITH_GEAR) target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBRARIES} DD4hepCore Geom Reflex ${libraries} ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES}) diff --git a/DDSegmentation/CMakeLists.txt b/DDSegmentation/CMakeLists.txt index 75a438142b20fa4fb062a00aba931bed10850f2f..242b2fa3051cf86d0fcf389367e8c143fc634f14 100644 --- a/DDSegmentation/CMakeLists.txt +++ b/DDSegmentation/CMakeLists.txt @@ -24,6 +24,12 @@ add_library(DDSegmentation SHARED ${sources}) SET_TARGET_PROPERTIES( DDSegmentation PROPERTIES VERSION ${DDSegmentation_VERSION} SOVERSION ${DDSegmentation_SOVERSION}) +#if DDSegmentation is build as part of dd4hep +if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) + SET ( DDSegmentation_LIBRARIES DDSegmentation PARENT_SCOPE ) + SET ( DDSegmentation_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE ) +endif() + install(DIRECTORY include/DDSegmentation DESTINATION include PATTERN ".svn" EXCLUDE ) diff --git a/DDSegmentation/cmake/DDSegmentationConfig.cmake.in b/DDSegmentation/cmake/DDSegmentationConfig.cmake.in index 2d74d16cb4ee7d6b36ad30696f671c62e1650eee..dfa7cbc8ab1455e889100f1872762ed6949b8103 100644 --- a/DDSegmentation/cmake/DDSegmentationConfig.cmake.in +++ b/DDSegmentation/cmake/DDSegmentationConfig.cmake.in @@ -7,7 +7,7 @@ # DDSegmentation_VERSION : package version # DDSegmentation_ROOT : path to this DDSegmentation installation # DDSegmentation_LIBRARIES : list of DD4hep libraries -# DDSegmentation_INCLUDE_DIR : list of paths to be used with INCLUDE_DIRECTORIES +# DDSegmentation_INCLUDE_DIRS : list of paths to be used with INCLUDE_DIRECTORIES # DDSegmentation_LIBRARY_DIR : list of paths to be used with LINK_DIRECTORIES # # @author Christian Grefe, CERN @@ -18,13 +18,18 @@ SET( DDSegmentation_VERSION "@DDSegmentation_VERSION@" ) # ---------- libraries -------------------------------------------------------- # do not store find results in cache -SET( DDSegmentation_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include" ) -SET( DDSegmentation_LIBRARY_DIR "@CMAKE_INSTALL_PREFIX@/lib" ) -SET( DDSegmentation_LIBRARIES DDSegmentation ) +SET( DDSegmentation_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include" ) + + +# Find the DDSegmentation libraries +find_library(DDSegmentation_LIBRARIES + NAMES DDSegmentation + PATHS "@CMAKE_INSTALL_PREFIX@/lib" +) + MARK_AS_ADVANCED( DDSegmentation_INCLUDE_DIRS DDSegmentation_LIBRARY_DIRS DDSegmentation_LIBRARIES ) INCLUDE( FindPackageHandleStandardArgs ) # set DDSegmentation_FOUND to TRUE if all listed variables are TRUE and not empty -FIND_PACKAGE_HANDLE_STANDARD_ARGS( DDSegmentation DEFAULT_MSG DDSegmentation_ROOT DDSegmentation_INCLUDE_DIR DDSegmentation_LIBRARIES ) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( DDSegmentation DEFAULT_MSG DDSegmentation_ROOT DDSegmentation_INCLUDE_DIRS DDSegmentation_LIBRARIES ) -SET( DDSegmentation_FOUND ${DDSegmentation_FOUND} )