diff --git a/FullSimLight/Plugins/Examples/UserActionPlugins/DummyUserActionPlugin/CMakeLists.txt b/FullSimLight/Plugins/Examples/UserActionPlugins/DummyUserActionPlugin/CMakeLists.txt index 4452ef6bb773c364177eea50d9941c96829ce868..17d346ff2e24354beab1ff0aae29d303c31133ec 100644 --- a/FullSimLight/Plugins/Examples/UserActionPlugins/DummyUserActionPlugin/CMakeLists.txt +++ b/FullSimLight/Plugins/Examples/UserActionPlugins/DummyUserActionPlugin/CMakeLists.txt @@ -49,7 +49,6 @@ set(PROJECT_SOURCES ${SOURCES}) # Set up the library. add_library(DummyUserActionPlugin SHARED ${SOURCES}) -#find_package (Eigen3 REQUIRED) find_package(Geant4 REQUIRED) #find_package(FullSimLight REQUIRED) find_package( HDF5 REQUIRED COMPONENTS CXX ) diff --git a/FullSimLight/Plugins/HitsPlugin/CMakeLists.txt b/FullSimLight/Plugins/HitsPlugin/CMakeLists.txt index 82a3a31a068f90b8a3df73d5342bf0a611170d6a..f0b207e808c41bda089fff9a2db0fc708b14cb46 100644 --- a/FullSimLight/Plugins/HitsPlugin/CMakeLists.txt +++ b/FullSimLight/Plugins/HitsPlugin/CMakeLists.txt @@ -51,7 +51,6 @@ set(PROJECT_SOURCES ${SOURCES}) # Set up the library. add_library(GenerateHitsPlugin SHARED ${SOURCES}) -#find_package (Eigen3 REQUIRED) find_package(Geant4 REQUIRED) #find_package(FullSimLight REQUIRED) find_package( HDF5 REQUIRED COMPONENTS CXX ) diff --git a/FullSimLight/Plugins/TracksPlugin/CMakeLists.txt b/FullSimLight/Plugins/TracksPlugin/CMakeLists.txt index 95886d16064604296fc46805b4206231f6e6ef7d..c3e04df4d69eb7fbacce48c03bd98b77c098d61c 100644 --- a/FullSimLight/Plugins/TracksPlugin/CMakeLists.txt +++ b/FullSimLight/Plugins/TracksPlugin/CMakeLists.txt @@ -50,7 +50,6 @@ set(PROJECT_SOURCES ${HEADERS} ${SOURCES} TracksPlugin.cc) # Set up the library. add_library(GenerateTracksPlugin SHARED ${HEADERS} ${SOURCES} TracksPlugin.cc) -#find_package (Eigen3 REQUIRED) find_package(Geant4 REQUIRED) #find_package(FullSimLight REQUIRED) find_package( HDF5 REQUIRED COMPONENTS CXX ) diff --git a/GeoModelCore/GeoModelKernel/CMakeLists.txt b/GeoModelCore/GeoModelKernel/CMakeLists.txt index 5f01934699c73582b9fd4178f0a3c988b225ff65..d49c84e643efde52771c3de5715696e88fbb311c 100644 --- a/GeoModelCore/GeoModelKernel/CMakeLists.txt +++ b/GeoModelCore/GeoModelKernel/CMakeLists.txt @@ -13,9 +13,6 @@ target_include_directories( GeoModelKernel PUBLIC $<INSTALL_INTERFACE:include> ) source_group( "GeoModelKernel" FILES ${HEADERS} ) source_group( "src" FILES ${SOURCES} ) -if( GEOMODEL_USE_BUILTIN_EIGEN3 ) - add_dependencies( GeoModelKernel Eigen3 ) -endif() set_target_properties( GeoModelKernel PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) diff --git a/cmake/SetupEigen3.cmake b/cmake/SetupEigen3.cmake index 9e64412ea08586b91f8e328b26a3cf0f85016401..6e3079f62fa6db81850abef92a05327f2e9d3603 100644 --- a/cmake/SetupEigen3.cmake +++ b/cmake/SetupEigen3.cmake @@ -5,60 +5,51 @@ # # Make sure that this file is only included once. -get_property( _eigenSetUp GLOBAL PROPERTY GEOMODEL_EIGEN_SET_UP SET ) -if( _eigenSetUp ) - unset( _eigenSetUp ) - return() -endif() -set_property( GLOBAL PROPERTY GEOMODEL_EIGEN_SET_UP TRUE ) +include_guard(GLOBAL) # Configuration option for how Eigen should be used. -option( GEOMODEL_USE_BUILTIN_EIGEN3 - "Download a version of Eigen3 during the build" FALSE ) +option(GEOMODEL_USE_BUILTIN_EIGEN3 "Download a version of Eigen3 during the build" OFF) # Now do what was requested. if( GEOMODEL_USE_BUILTIN_EIGEN3 ) - - # Tell the user what's happening. - message( STATUS "Building Eigen3 as part of the project" ) - - # Helper variables for the Eigen build. - set( Eigen3_INCLUDE_DIR - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Install/include/eigen3" ) - set( Eigen3_VERSION "3.2.9" ) - - # Create the include directory already, otherwise CMake refuses to - # create the imported target. - file( MAKE_DIRECTORY "${Eigen3_INCLUDE_DIR}" ) - - # Build/install Eigen3 using ExternalProject_Add(...). - include( ExternalProject ) - ExternalProject_Add( Eigen3 - PREFIX ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Build - INSTALL_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Install - URL "http://cern.ch/lcgpackages/tarFiles/sources/eigen-${Eigen3_VERSION}.tar.gz" - URL_MD5 "de04f424e6b86907ccc9737b5d3048e7" - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> - BUILD_BYPRODUCTS "${Eigen3_INCLUDE_DIR}" ) - ExternalProject_Add_Step( Eigen3 removepc - COMMAND ${CMAKE_COMMAND} -E remove_directory <INSTALL_DIR>/share - COMMENT "Removing the pkgconfig file from Eigen" - DEPENDEES install ) - install( DIRECTORY - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Install/ - DESTINATION . - COMPONENT Development - USE_SOURCE_PERMISSIONS ) - - # Set up an imported target that mimicks the one created by the exported - # CMake configuration of an Eigen installation. - add_library( Eigen3::Eigen INTERFACE IMPORTED ) - set_target_properties( Eigen3::Eigen PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${Eigen3_INCLUDE_DIR}" ) - + # Tell the user what's happening. + message( STATUS "Building Eigen3 as part of the project" ) + + # Helper variables for the Eigen build. + set( Eigen3_INCLUDE_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Install/include/eigen3" ) + set( Eigen3_VERSION "3.2.9" ) + + # Create the include directory already, otherwise CMake refuses to + # create the imported target. + file( MAKE_DIRECTORY "${Eigen3_INCLUDE_DIR}" ) + + # Build/install Eigen3 using ExternalProject_Add(...). + include( ExternalProject ) + ExternalProject_Add( Eigen3 + PREFIX ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Build + INSTALL_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Install + URL "http://cern.ch/lcgpackages/tarFiles/sources/eigen-${Eigen3_VERSION}.tar.gz" + URL_MD5 "de04f424e6b86907ccc9737b5d3048e7" + CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> + BUILD_BYPRODUCTS "${Eigen3_INCLUDE_DIR}" ) + ExternalProject_Add_Step( Eigen3 removepc + COMMAND ${CMAKE_COMMAND} -E remove_directory <INSTALL_DIR>/share + COMMENT "Removing the pkgconfig file from Eigen" + DEPENDEES install ) + install( DIRECTORY + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Eigen3Install/ + DESTINATION . + COMPONENT Development + USE_SOURCE_PERMISSIONS ) + + # Set up an imported target that mimicks the one created by the exported + # CMake configuration of an Eigen installation. + add_library( Eigen3::Eigen INTERFACE IMPORTED ) + set_target_properties( Eigen3::Eigen PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${Eigen3_INCLUDE_DIR}" ) + + # Add dependency to the underlying external project + add_dependencies(Eigen3::Eigen Eigen3) else() - - # Just find an existing installation of Eigen3. - find_package( Eigen3 REQUIRED NO_MODULE ) - + # Just find an existing installation of Eigen3. + find_package( Eigen3 REQUIRED NO_MODULE ) endif()