# FindGENFIT # ---------- # # Find the GENFIT includes and library. # # IMPORTED Targets # ^^^^^^^^^^^^^^^^ # # This module defines :prop_tgt:`IMPORTED` target ``GENFIT::GENFIT``, if # GENFIT has been found. # # Result Variables # ^^^^^^^^^^^^^^^^ # # This module defines the following variables: # # :: # # GENFIT_INCLUDE_DIRS - where to find Track.h, etc. # GENFIT_LIBRARIES - List of libraries when using genfit. # GENFIT_FOUND - True if genfit found. # # :: # # As GENFIT does not have a file where we could read out the build / found version we do NOT define: # GENFIT_VERSION_STRING # GENFIT_VERSION_MAJOR # GENFIT_VERSION_MINOR # GENFIT_VERSION_PATCH # as a consequence we will/can NOT check for a specific requested version! # # Hints # ^^^^^ # # A user may set ``GENFIT_ROOT`` to a genfit installation root to tell this # module where to look. #============================================================================= # This file is heavily inspired by the offical CMake module FindZLIB.cmake #============================================================================= # # # manager COMET Software Group # author andreas.jansen@tu-dresden.de set(_GENFIT_SEARCHES) # Search GENFIT_ROOT first if it is set. if(GENFIT_ROOT) set(_GENFIT_SEARCH_ROOT PATHS ${GENFIT_ROOT} NO_DEFAULT_PATH) list(APPEND _GENFIT_SEARCHES _GENFIT_SEARCH_ROOT) endif() # Normal search. set(_GENFIT_SEARCH_NORMAL PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\GENFIT;InstallPath]" "$ENV{PROGRAMFILES}/genfit" ) list(APPEND _GENFIT_SEARCHES _GENFIT_SEARCH_NORMAL) set(GENFIT_NAMES genfit genfit2) # No debug libs, so debug-names are set to the same as release set(GENFIT_NAMES_DEBUG ${GENFIT_NAMES}) # Try each search configuration, use "Track.h" as locator foreach(search ${_GENFIT_SEARCHES}) find_path(GENFIT_INCLUDE_DIR NAMES Track.h ${${search}} PATH_SUFFIXES include) endforeach() # Allow GENFIT_LIBRARY to be set manually, as the location of the genfit library # prefer lib64 if available! if(NOT GENFIT_LIBRARY) foreach(search ${_GENFIT_SEARCHES}) find_library(GENFIT_LIBRARY_RELEASE NAMES ${GENFIT_NAMES} ${${search}} PATH_SUFFIXES lib64 lib) find_library(GENFIT_LIBRARY_DEBUG NAMES ${GENFIT_NAMES_DEBUG} ${${search}} PATH_SUFFIXES lib64 lib) endforeach() include(SelectLibraryConfigurations) select_library_configurations(GENFIT) endif() unset(GENFIT_NAMES) unset(GENFIT_NAMES_DEBUG) # 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 REQUIRED_VARS GENFIT_LIBRARY GENFIT_INCLUDE_DIR) if(GENFIT_FOUND) set(GENFIT_INCLUDE_DIRS ${GENFIT_INCLUDE_DIR}) if(NOT GENFIT_LIBRARIES) set(GENFIT_LIBRARIES ${GENFIT_LIBRARY}) endif() if(NOT TARGET GENFIT::GENFIT) add_library(GENFIT::GENFIT UNKNOWN IMPORTED) set_target_properties(GENFIT::GENFIT PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GENFIT_INCLUDE_DIRS}") if(GENFIT_LIBRARY_RELEASE) set_property(TARGET GENFIT::GENFIT APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) set_target_properties(GENFIT::GENFIT PROPERTIES IMPORTED_LOCATION_RELEASE "${GENFIT_LIBRARY_RELEASE}") endif() if(GENFIT_LIBRARY_DEBUG) set_property(TARGET GENFIT::GENFIT APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) set_target_properties(GENFIT::GENFIT PROPERTIES IMPORTED_LOCATION_DEBUG "${GENFIT_LIBRARY_DEBUG}") endif() if(NOT GENFIT_LIBRARY_RELEASE AND NOT GENFIT_LIBRARY_DEBUG) set_property(TARGET GENFIT::GENFIT APPEND PROPERTY IMPORTED_LOCATION "${GENFIT_LIBRARY}") endif() endif() endif()