Skip to content
Snippets Groups Projects
Unverified Commit 4e8903ed authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn Committed by GitHub
Browse files

Merge pull request #125 from mirguest/master

Add GenFit support in CEPCSW
parents 79fc7481 f4bea309
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ if(NOT CMAKE_CXX_STANDARD MATCHES "14|17")
message(FATAL_ERROR "Unsupported C++ standard: ${CMAKE_CXX_STANDARD}")
endif()
list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # (Find*.cmake)
include(cmake/CEPCSWDependencies.cmake)
add_subdirectory(Analysis)
......
......@@ -18,6 +18,10 @@ gaudi_add_module(Examples
${podio_LIBRARIES} podio::podioRootIO
)
if (GenFit_FOUND)
target_link_libraries(Examples PUBLIC GenFit::genfit2)
endif()
target_include_directories(Examples PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>/include
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
......
......@@ -31,3 +31,4 @@ find_package(LCIO REQUIRED)
find_package(PandoraSDK REQUIRED)
find_package(podio REQUIRED)
find_package(ROOT COMPONENTS EG Graf Graf3d Gpad MathCore Net RIO Tree TreePlayer REQUIRED)
find_package(GenFit)
# - Try to find GenFit
# Defines:
#
# GenFit_FOUND
# GenFit_INCLUDE_DIRS
# GenFit_LIBRARIES
#
# Imports:
#
# GenFit::genfit2
#
# Usage of the target instead of the variables is advised
# Find quietly if already found before
if(DEFINED CACHE{GenFit_INCLUDE_DIRS})
set(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY YES)
endif()
find_path(GenFit_INCLUDE_DIRS NAMES GFGbl.h
HINTS ${GENFIT_ROOT_DIR}/include $ENV{GENFIT_ROOT_DIR}/include
${GenFit_DIR}/include $ENV{GenFit_DIR}/include
${CMAKE_PREFIX_PATH}/include
)
find_library(GenFit_LIBRARIES NAMES genfit2
HINTS $ENV{GENFIT_ROOT_DIR}/lib ${GENFIT_ROOT_DIR}/lib
${GenFit_DIR}/lib ${GenFit_DIR}/lib64
$ENV{GenFit_DIR}/lib $ENV{GenFit_DIR}/lib64
${CMAKE_PREFIX_PATH}/lib ${CMAKE_PREFIX_PATH}/lib64
)
# handle the QUIETLY and REQUIRED arguments and set GENFIT_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GenFit DEFAULT_MSG GenFit_INCLUDE_DIRS GenFit_LIBRARIES)
mark_as_advanced(GenFit_FOUND GenFit_INCLUDE_DIRS GenFit_LIBRARIES)
# Modernisation: create an interface target to link against
if(TARGET GenFit::genfit2)
return()
endif()
if(GenFit_FOUND)
add_library(GenFit::genfit2 IMPORTED INTERFACE)
target_include_directories(GenFit::genfit2 SYSTEM INTERFACE "${GenFit_INCLUDE_DIRS}")
target_link_libraries(GenFit::genfit2 INTERFACE "${GenFit_LIBRARIES}")
# Display the imported target for the user to know
if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
message(STATUS " Import target: GenFit::genfit2")
endif()
endif()
if(COMMAND __deprecate_var_for_target)
variable_watch(GenFit_INCLUDE_DIRS __deprecate_var_for_target)
endif()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment