diff --git a/cmake/Modules/FindHepMC.cmake b/cmake/Modules/FindHepMC.cmake index 97ec9ba..a311f15 100644 --- a/cmake/Modules/FindHepMC.cmake +++ b/cmake/Modules/FindHepMC.cmake @@ -1,228 +1,218 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. # This is a slightly modified version of FindGSL.cmake taken from cmake 3.7 #.rst: # FindHepMC # -------- # # Find the native HepMC includes and libraries. # # HepMC package is an object oriented, C++ event record for High Energy # Physics Monte Carlo generators and simulation. It is free software # under the GNU General Public License. # # Imported Targets # ^^^^^^^^^^^^^^^^ # # If HepMC is found, this module defines the following # :prop_tgt:`IMPORTED` target:: # # HepMC::HepMC - The main HepMC library. # # Result Variables # ^^^^^^^^^^^^^^^^ # # This module will set the following variables in your project:: # # HepMC_FOUND - True if HepMC found on the local system # HepMC_INCLUDE_DIRS - Location of HepMC header files. # HepMC_LIBRARIES - The HepMC libraries. # HepMC_VERSION - The version of the discovered HepMC install. # # Hints # ^^^^^ # # Set ``HepMC_ROOT_DIR`` to a directory that contains a HepMC installation. # # This script expects to find libraries at ``$HepMC_ROOT_DIR/lib`` and the HepMC # headers at ``$HepMC_ROOT_DIR/include/HepMC``. The library directory may # optionally provide Release and Debug folders. For Unix-like systems, this # script will use ``$HepMC_ROOT_DIR/bin/HepMC-config`` (if found) to aid in the # discovery HepMC. # # Cache Variables # ^^^^^^^^^^^^^^^ # # This module may set the following variables depending on platform and type # of HepMC installation discovered. These variables may optionally be set to # help this module find the correct files:: # # HepMC_CONFIG_EXECUTABLE - Location of the ``HepMC-config`` script (if any). # HepMC_LIBRARY - Location of the HepMC library. # HepMC_LIBRARY_DEBUG - Location of the debug HepMC library (if any). # # Include these modules to handle the QUIETLY and REQUIRED arguments. include(FindPackageHandleStandardArgs) #============================================================================= # If the user has provided ``HepMC_ROOT_DIR``, use it! Choose items found # at this location over system locations. if( EXISTS "$ENV{HepMC_ROOT_DIR}" ) file( TO_CMAKE_PATH "$ENV{HepMC_ROOT_DIR}" HepMC_ROOT_DIR ) set( HepMC_ROOT_DIR "${HepMC_ROOT_DIR}" CACHE PATH "Prefix for HepMC installation." ) endif() if( NOT EXISTS "${HepMC_ROOT_DIR}" ) set( HepMC_USE_PKGCONFIG ON ) endif() #============================================================================= # As a first try, use the PkgConfig module. This will work on many # *NIX systems. See :module:`findpkgconfig` # This will return ``HepMC_INCLUDEDIR`` and ``HepMC_LIBDIR`` used below. if( HepMC_USE_PKGCONFIG ) find_package(PkgConfig) pkg_check_modules( HepMC QUIET HepMC ) if( EXISTS "${HepMC_INCLUDEDIR}" ) get_filename_component( HepMC_ROOT_DIR "${HepMC_INCLUDEDIR}" DIRECTORY CACHE) endif() endif() #============================================================================= # Set HepMC_INCLUDE_DIRS and HepMC_LIBRARIES. If we skipped the PkgConfig step, try # to find the libraries at $HepMC_ROOT_DIR (if provided), in the directory # suggested by HepMC-config (if available), or in standard system # locations. These find_library and find_path calls will prefer custom # locations over standard locations (HINTS). If the requested file is found # neither at the HINTS location nor via HepMC-config, standard system locations # will be still be searched (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)). # If we didn't use PkgConfig, try to find the version via HepMC-config if( NOT HepMC_VERSION ) find_program( HepMC_CONFIG_EXECUTABLE NAMES HepMC-config HINTS "${HepMC_ROOT_DIR}/bin" ) if( EXISTS "${HepMC_CONFIG_EXECUTABLE}" ) execute_process( COMMAND "${HepMC_CONFIG_EXECUTABLE}" --version OUTPUT_VARIABLE HepMC_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND "${HepMC_CONFIG_EXECUTABLE}" --incdir OUTPUT_VARIABLE HepMC_CONFIG_INCLUDEDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND "${HepMC_CONFIG_EXECUTABLE}" --libdir OUTPUT_VARIABLE HepMC_CONFIG_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() endif() find_path( HepMC_INCLUDE_DIR NAMES HepMC/HepMC.h HepMC/HepMCDefs.h HINTS ${HepMC_ROOT_DIR}/include ${HepMC_INCLUDEDIR} ${HepMC_CONFIG_INCLUDEDIR} ) find_library( HepMC_LIBRARY NAMES HepMC HINTS ${HepMC_ROOT_DIR}/lib ${HepMC_LIBDIR} ${HepMC_CONFIG_LIBDIR} PATH_SUFFIXES Release Debug ) # Do we also have debug versions? find_library( HepMC_LIBRARY_DEBUG NAMES HepMC HINTS ${HepMC_ROOT_DIR}/lib ${HepMC_LIBDIR} ${HepMC_CONFIG_LIBDIR} PATH_SUFFIXES Debug ) set( HepMC_INCLUDE_DIRS ${HepMC_INCLUDE_DIR} ) set( HepMC_LIBRARIES ${HepMC_LIBRARY} ) if( NOT HepMC_VERSION ) if(IS_DIRECTORY ${HepMC_INCLUDE_DIR}) file(STRINGS "${HepMC_INCLUDE_DIR}/HepMC/HepMCDefs.h" _HepMC_DEFS) file(STRINGS "${HepMC_INCLUDE_DIR}/HepMC/Version.h" _HepMC_VERS) string( REGEX MATCH "#define *HEPMC_VERSION *\"[^\"]*\"" _HepMC_VERSION_STR "${_HepMC_DEFS} ${_HepMC_VERS}" ) string( REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" HepMC_VERSION ${_HepMC_VERSION_STR} ) endif() endif() if( HepMC_VERSION ) - string( - REGEX MATCH - "^[0-9]*" - HepMC_VERSION_MAJOR ${HepMC_VERSION} - ) - string( - REGEX REPLACE - "^[0-9]*\\.([0-9]*)" "\\1" - HepMC_VERSION_MINOR ${HepMC_VERSION} - ) - string( - REGEX MATCH - "[0-9]*$" - HepMC_VERSION_PATCH ${HepMC_VERSION} - ) + string(REPLACE "." ";" t_list ${HepMC_VERSION}) + list(APPEND t_list 0 0) # add a buffer in case supversion not set + list(GET t_list 0 HepMC_VERSION_MAJOR) + list(GET t_list 1 HepMC_VERSION_MINOR) + list(GET t_list 2 HepMC_VERSION_PATCH) endif() #============================================================================= # handle the QUIETLY and REQUIRED arguments and set HepMC_FOUND to TRUE if all # listed variables are TRUE find_package_handle_standard_args( HepMC FOUND_VAR HepMC_FOUND REQUIRED_VARS HepMC_INCLUDE_DIR HepMC_LIBRARY VERSION_VAR HepMC_VERSION ) mark_as_advanced( HepMC_ROOT_DIR HepMC_VERSION HepMC_LIBRARY HepMC_INCLUDE_DIR HepMC_LIBRARY_DEBUG HepMC_USE_PKGCONFIG HepMC_CONFIG ) #============================================================================= # Register imported libraries: # 1. If we can find a Windows .dll file (or if we can find both Debug and # Release libraries), we will set appropriate target properties for these. # 2. However, for most systems, we will only register the import location and # include directory. # Look for dlls, or Release and Debug libraries. if(WIN32) string( REPLACE ".lib" ".dll" HepMC_LIBRARY_DLL "${HepMC_LIBRARY}" ) string( REPLACE ".lib" ".dll" HepMC_LIBRARY_DEBUG_DLL "${HepMC_LIBRARY_DEBUG}" ) endif() if( HepMC_FOUND AND NOT TARGET HepMC::HepMC ) if( EXISTS "${HepMC_LIBRARY_DLL}") # Windows systems with dll libraries. add_library( HepMC::HepMC SHARED IMPORTED ) add_library( HepMC::HepMCcblas SHARED IMPORTED ) # Windows with dlls, but only Release libraries. set_target_properties( HepMC::HepMC PROPERTIES IMPORTED_LOCATION_RELEASE "${HepMC_LIBRARY_DLL}" IMPORTED_IMPLIB "${HepMC_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${HepMC_INCLUDE_DIRS}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" ) # If we have both Debug and Release libraries if( EXISTS "${HepMC_LIBRARY_DEBUG_DLL}") set_property( TARGET HepMC::HepMC APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) set_target_properties( HepMC::HepMC PROPERTIES IMPORTED_LOCATION_DEBUG "${HepMC_LIBRARY_DEBUG_DLL}" IMPORTED_IMPLIB_DEBUG "${HepMC_LIBRARY_DEBUG}" ) endif() else() # For all other environments (ones without dll libraries), create # the imported library targets. add_library( HepMC::HepMC UNKNOWN IMPORTED ) set_target_properties( HepMC::HepMC PROPERTIES IMPORTED_LOCATION "${HepMC_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${HepMC_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" ) endif() endif() diff --git a/cmake/Modules/FindQCDloop.cmake b/cmake/Modules/FindQCDloop.cmake index 063ef5b..5b05fc9 100644 --- a/cmake/Modules/FindQCDloop.cmake +++ b/cmake/Modules/FindQCDloop.cmake @@ -1,200 +1,205 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. # This is a slightly modified version of FindGSL.cmake taken from cmake 3.7 #.rst: # FindQCDloop # -------- # # Find the native QCDloop includes and libraries. # # QCDLoop is a library for one-loop scalar Feynman integrals. It is free # software under the GNU General Public License. # # Imported Targets # ^^^^^^^^^^^^^^^^ # # If QCDloop is found, this module defines the following # :prop_tgt:`IMPORTED` target:: # # QCDloop::qcdloop - The main QCDloop library. # # Result Variables # ^^^^^^^^^^^^^^^^ # # This module will set the following variables in your project:: # # QCDloop_FOUND - True if QCDloop found on the local system # QCDloop_INCLUDE_DIRS - Location of QCDloop header files. # QCDloop_LIBRARIES - The QCDloop libraries. # QCDloop_VERSION - The version of the discovered QCDloop install. # # Hints # ^^^^^ # # Set ``QCDloop_ROOT_DIR`` to a directory that contains a QCDloop installation. # # This script expects to find libraries at ``$QCDloop_ROOT_DIR/lib`` and the QCDloop # headers at ``$QCDloop_ROOT_DIR/include/qcdloop``. The library directory may # optionally provide Release and Debug folders. For Unix-like systems, this # script will use ``$QCDloop_ROOT_DIR/bin/qcdloop-config`` (if found) to aid in the # discovery QCDloop. # # Cache Variables # ^^^^^^^^^^^^^^^ # # This module may set the following variables depending on platform and type # of QCDloop installation discovered. These variables may optionally be set to # help this module find the correct files:: # # QCDloop_CONFIG_EXECUTABLE - Location of the ``qcdloop-config`` script (if any). # QCDloop_LIBRARY - Location of the QCDloop library. # QCDloop_LIBRARY_DEBUG - Location of the debug QCDloop library (if any). # # Include these modules to handle the QUIETLY and REQUIRED arguments. include(FindPackageHandleStandardArgs) #============================================================================= # If the user has provided ``QCDloop_ROOT_DIR``, use it! Choose items found # at this location over system locations. if( EXISTS "$ENV{QCDloop_ROOT_DIR}" ) file( TO_CMAKE_PATH "$ENV{QCDloop_ROOT_DIR}" QCDloop_ROOT_DIR ) set( QCDloop_ROOT_DIR "${QCDloop_ROOT_DIR}" CACHE PATH "Prefix for QCDloop installation." ) endif() if( NOT EXISTS "${QCDloop_ROOT_DIR}" ) set( QCDloop_USE_PKGCONFIG ON ) endif() #============================================================================= # As a first try, use the PkgConfig module. This will work on many # *NIX systems. See :module:`findpkgconfig` # This will return ``QCDloop_INCLUDEDIR`` and ``QCDloop_LIBDIR`` used below. if( QCDloop_USE_PKGCONFIG ) find_package(PkgConfig) pkg_check_modules( QCDloop QUIET qcdloop ) if( EXISTS "${QCDloop_INCLUDEDIR}" ) get_filename_component( QCDloop_ROOT_DIR "${QCDloop_INCLUDEDIR}" DIRECTORY CACHE) endif() endif() #============================================================================= # Set QCDloop_INCLUDE_DIRS and QCDloop_LIBRARIES. If we skipped the PkgConfig step, try # to find the libraries at $QCDloop_ROOT_DIR (if provided), in the directory # suggested by qcdloop-config (if available), or in standard system # locations. These find_library and find_path calls will prefer custom # locations over standard locations (HINTS). If the requested file is found # neither at the HINTS location nor via qcdloop-config, standard system locations # will be still be searched (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)). # If we didn't use PkgConfig, try to find the version via qcdloop-config if( NOT QCDloop_VERSION ) find_program( QCDloop_CONFIG_EXECUTABLE NAMES qcdloop-config HINTS "${QCDloop_ROOT_DIR}/bin" ) if( EXISTS "${QCDloop_CONFIG_EXECUTABLE}" ) execute_process( COMMAND "${QCDloop_CONFIG_EXECUTABLE}" --version OUTPUT_VARIABLE QCDloop_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND "${QCDloop_CONFIG_EXECUTABLE}" --incdir OUTPUT_VARIABLE QCDloop_CONFIG_INCLUDEDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND "${QCDloop_CONFIG_EXECUTABLE}" --libdir OUTPUT_VARIABLE QCDloop_CONFIG_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() endif() find_path( QCDloop_INCLUDE_DIR NAMES qcdloop/qcdloop.h HINTS ${QCDloop_ROOT_DIR}/include ${QCDloop_INCLUDEDIR} ${QCDloop_CONFIG_INCLUDEDIR} ) find_library( QCDloop_LIBRARY NAMES qcdloop HINTS ${QCDloop_ROOT_DIR}/lib ${QCDloop_LIBDIR} ${QCDloop_CONFIG_LIBDIR} PATH_SUFFIXES Release Debug ) # Do we also have debug versions? find_library( QCDloop_LIBRARY_DEBUG NAMES qcdloop HINTS ${QCDloop_ROOT_DIR}/lib ${QCDloop_LIBDIR} ${QCDloop_CONFIG_LIBDIR} PATH_SUFFIXES Debug ) set( QCDloop_INCLUDE_DIRS ${QCDloop_INCLUDE_DIR} ) set( QCDloop_LIBRARIES ${QCDloop_LIBRARY} ) if( QCDloop_VERSION )# remove "" in QCDloop version string(REGEX REPLACE "\"" "" QCDloop_VERSION ${QCDloop_VERSION}) + string(REPLACE "." ";" t_list ${QCDloop_VERSION}) + list(APPEND t_list 0 0) # add a buffer in case supversion not set + list(GET t_list 0 QCDloop_VERSION_MAJOR) + list(GET t_list 1 QCDloop_VERSION_MINOR) + list(GET t_list 2 QCDloop_VERSION_PATCH) endif() #============================================================================= # handle the QUIETLY and REQUIRED arguments and set QCDloop_FOUND to TRUE if all # listed variables are TRUE find_package_handle_standard_args( QCDloop FOUND_VAR QCDloop_FOUND REQUIRED_VARS QCDloop_INCLUDE_DIR QCDloop_LIBRARY VERSION_VAR QCDloop_VERSION ) mark_as_advanced( QCDloop_ROOT_DIR QCDloop_VERSION QCDloop_LIBRARY QCDloop_INCLUDE_DIR QCDloop_LIBRARY_DEBUG QCDloop_USE_PKGCONFIG QCDloop_CONFIG ) #============================================================================= # Register imported libraries: # 1. If we can find a Windows .dll file (or if we can find both Debug and # Release libraries), we will set appropriate target properties for these. # 2. However, for most systems, we will only register the import location and # include directory. # Look for dlls, or Release and Debug libraries. if(WIN32) string( REPLACE ".lib" ".dll" QCDloop_LIBRARY_DLL "${QCDloop_LIBRARY}" ) string( REPLACE ".lib" ".dll" QCDloop_LIBRARY_DEBUG_DLL "${QCDloop_LIBRARY_DEBUG}" ) endif() if( QCDloop_FOUND AND NOT TARGET QCDloop::qcdloop ) if( EXISTS "${QCDloop_LIBRARY_DLL}") # Windows systems with dll libraries. add_library( QCDloop::qcdloop SHARED IMPORTED ) add_library( QCDloop::qcdloopcblas SHARED IMPORTED ) # Windows with dlls, but only Release libraries. set_target_properties( QCDloop::qcdloop PROPERTIES IMPORTED_LOCATION_RELEASE "${QCDloop_LIBRARY_DLL}" IMPORTED_IMPLIB "${QCDloop_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${QCDloop_INCLUDE_DIRS}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" ) # If we have both Debug and Release libraries if( EXISTS "${QCDloop_LIBRARY_DEBUG_DLL}") set_property( TARGET QCDloop::qcdloop APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) set_target_properties( QCDloop::qcdloop PROPERTIES IMPORTED_LOCATION_DEBUG "${QCDloop_LIBRARY_DEBUG_DLL}" IMPORTED_IMPLIB_DEBUG "${QCDloop_LIBRARY_DEBUG}" ) endif() else() # For all other environments (ones without dll libraries), create # the imported library targets. add_library( QCDloop::qcdloop UNKNOWN IMPORTED ) set_target_properties( QCDloop::qcdloop PROPERTIES IMPORTED_LOCATION "${QCDloop_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${QCDloop_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" ) endif() endif() diff --git a/cmake/Modules/Findrivet.cmake b/cmake/Modules/Findrivet.cmake index 05ab9fb..27f99b4 100644 --- a/cmake/Modules/Findrivet.cmake +++ b/cmake/Modules/Findrivet.cmake @@ -1,227 +1,217 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file Copyright.txt or https://cmake.org/licensing for details. # This is a slightly modified version of FindGSL.cmake taken from cmake 3.7 #.rst: # Findrivet # -------- # # Find the native rivet includes and libraries. # # rivet package is an object oriented, C++ analysis tool for High Energy # Physics Monte Carlo generators and simulation. It is free software # under the GNU General Public License. # # Imported Targets # ^^^^^^^^^^^^^^^^ # # If rivet is found, this module defines the following # :prop_tgt:`IMPORTED` target:: # # rivet::rivet - The main rivet library. # # Result Variables # ^^^^^^^^^^^^^^^^ # # This module will set the following variables in your project:: # # rivet_FOUND - True if rivet found on the local system # rivet_INCLUDE_DIRS - Location of rivet header files. # rivet_LIBRARIES - The rivet libraries. # rivet_VERSION - The version of the discovered rivet install. # # Hints # ^^^^^ # # Set ``rivet_ROOT_DIR`` to a directory that contains a rivet installation. # # This script expects to find libraries at ``$rivet_ROOT_DIR/lib`` and the rivet # headers at ``$rivet_ROOT_DIR/include/rivet``. The library directory may # optionally provide Release and Debug folders. For Unix-like systems, this # script will use ``$rivet_ROOT_DIR/bin/rivet-config`` (if found) to aid in the # discovery rivet. # # Cache Variables # ^^^^^^^^^^^^^^^ # # This module may set the following variables depending on platform and type # of rivet installation discovered. These variables may optionally be set to # help this module find the correct files:: # # rivet_CONFIG_EXECUTABLE - Location of the ``rivet-config`` script (if any). # rivet_LIBRARY - Location of the rivet library. # rivet_LIBRARY_DEBUG - Location of the debug rivet library (if any). # # Include these modules to handle the QUIETLY and REQUIRED arguments. include(FindPackageHandleStandardArgs) #============================================================================= # If the user has provided ``rivet_ROOT_DIR``, use it! Choose items found # at this location over system locations. if( EXISTS "$ENV{rivet_ROOT_DIR}" ) file( TO_CMAKE_PATH "$ENV{rivet_ROOT_DIR}" rivet_ROOT_DIR ) set( rivet_ROOT_DIR "${rivet_ROOT_DIR}" CACHE PATH "Prefix for rivet installation." ) endif() if( NOT EXISTS "${rivet_ROOT_DIR}" ) set( rivet_USE_PKGCONFIG ON ) endif() #============================================================================= # As a first try, use the PkgConfig module. This will work on many # *NIX systems. See :module:`findpkgconfig` # This will return ``rivet_INCLUDEDIR`` and ``rivet_LIBDIR`` used below. if( rivet_USE_PKGCONFIG ) find_package(PkgConfig) pkg_check_modules( rivet QUIET rivet ) if( EXISTS "${rivet_INCLUDEDIR}" ) get_filename_component( rivet_ROOT_DIR "${rivet_INCLUDEDIR}" DIRECTORY CACHE) endif() endif() #============================================================================= # Set rivet_INCLUDE_DIRS and rivet_LIBRARIES. If we skipped the PkgConfig step, try # to find the libraries at $rivet_ROOT_DIR (if provided), in the directory # suggested by rivet-config (if available), or in standard system # locations. These find_library and find_path calls will prefer custom # locations over standard locations (HINTS). If the requested file is found # neither at the HINTS location nor via rivet-config, standard system locations # will be still be searched (/usr/lib64 (Redhat), lib/i386-linux-gnu (Debian)). # If we didn't use PkgConfig, try to find the version via rivet-config if( NOT rivet_VERSION ) find_program( rivet_CONFIG_EXECUTABLE NAMES rivet-config HINTS "${rivet_ROOT_DIR}/bin" ) if( EXISTS "${rivet_CONFIG_EXECUTABLE}" ) execute_process( COMMAND "${rivet_CONFIG_EXECUTABLE}" --version OUTPUT_VARIABLE rivet_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND "${rivet_CONFIG_EXECUTABLE}" --includedir OUTPUT_VARIABLE rivet_CONFIG_INCLUDEDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND "${rivet_CONFIG_EXECUTABLE}" --libdir OUTPUT_VARIABLE rivet_CONFIG_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) endif() endif() find_path( rivet_INCLUDE_DIR NAMES Rivet/Rivet.hh HINTS ${rivet_ROOT_DIR}/include ${rivet_INCLUDEDIR} ${rivet_CONFIG_INCLUDEDIR} ) find_library( rivet_LIBRARY NAMES Rivet HINTS ${rivet_ROOT_DIR}/lib ${rivet_LIBDIR} ${rivet_CONFIG_LIBDIR} PATH_SUFFIXES Release Debug ) # Do we also have debug versions? find_library( rivet_LIBRARY_DEBUG NAMES Rivet HINTS ${rivet_ROOT_DIR}/lib ${rivet_LIBDIR} ${rivet_CONFIG_LIBDIR} PATH_SUFFIXES Debug ) set( rivet_INCLUDE_DIRS ${rivet_INCLUDE_DIR} ) set( rivet_LIBRARIES ${rivet_LIBRARY} ) if( NOT rivet_VERSION ) if(IS_DIRECTORY ${rivet_INCLUDE_DIR}) file(STRINGS "${rivet_INCLUDE_DIR}/Rivet/Config/RivetConfig.hh" _rivet_VERS) string( REGEX MATCH "#define *RIVET_VERSION *\"[^\"]*\"" _rivet_VERSION_STR "${_rivet_VERS}" ) string( REGEX MATCH "[0-9]*\\.[0-9]*\\.[0-9]*" rivet_VERSION ${_rivet_VERSION_STR} ) endif() endif() if( rivet_VERSION ) - string( - REGEX MATCH - "^[0-9]*" - rivet_VERSION_MAJOR ${rivet_VERSION} - ) - string( - REGEX REPLACE - "^[0-9]*\\.([0-9]*)" "\\1" - rivet_VERSION_MINOR ${rivet_VERSION} - ) - string( - REGEX MATCH - "[0-9]*$" - rivet_VERSION_PATCH ${rivet_VERSION} - ) + string(REPLACE "." ";" t_list ${rivet_VERSION}) + list(APPEND t_list 0 0) # add a buffer in case supversion not set + list(GET t_list 0 rivet_VERSION_MAJOR) + list(GET t_list 1 rivet_VERSION_MINOR) + list(GET t_list 2 rivet_VERSION_PATCH) endif() #============================================================================= # handle the QUIETLY and REQUIRED arguments and set rivet_FOUND to TRUE if all # listed variables are TRUE find_package_handle_standard_args( rivet FOUND_VAR rivet_FOUND REQUIRED_VARS rivet_INCLUDE_DIR rivet_LIBRARY VERSION_VAR rivet_VERSION ) mark_as_advanced( rivet_ROOT_DIR rivet_VERSION rivet_LIBRARY rivet_INCLUDE_DIR rivet_LIBRARY_DEBUG rivet_USE_PKGCONFIG rivet_CONFIG ) #============================================================================= # Register imported libraries: # 1. If we can find a Windows .dll file (or if we can find both Debug and # Release libraries), we will set appropriate target properties for these. # 2. However, for most systems, we will only register the import location and # include directory. # Look for dlls, or Release and Debug libraries. if(WIN32) string( REPLACE ".lib" ".dll" rivet_LIBRARY_DLL "${rivet_LIBRARY}" ) string( REPLACE ".lib" ".dll" rivet_LIBRARY_DEBUG_DLL "${rivet_LIBRARY_DEBUG}" ) endif() if( rivet_FOUND AND NOT TARGET rivet::rivet ) if( EXISTS "${rivet_LIBRARY_DLL}") # Windows systems with dll libraries. add_library( rivet::rivet SHARED IMPORTED ) add_library( rivet::rivetcblas SHARED IMPORTED ) # Windows with dlls, but only Release libraries. set_target_properties( rivet::rivet PROPERTIES IMPORTED_LOCATION_RELEASE "${rivet_LIBRARY_DLL}" IMPORTED_IMPLIB "${rivet_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${rivet_INCLUDE_DIRS}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" ) # If we have both Debug and Release libraries if( EXISTS "${rivet_LIBRARY_DEBUG_DLL}") set_property( TARGET rivet::rivet APPEND PROPERTY IMPORTED_CONFIGURATIONS Debug ) set_target_properties( rivet::rivet PROPERTIES IMPORTED_LOCATION_DEBUG "${rivet_LIBRARY_DEBUG_DLL}" IMPORTED_IMPLIB_DEBUG "${rivet_LIBRARY_DEBUG}" ) endif() else() # For all other environments (ones without dll libraries), create # the imported library targets. add_library( rivet::rivet UNKNOWN IMPORTED ) set_target_properties( rivet::rivet PROPERTIES IMPORTED_LOCATION "${rivet_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${rivet_INCLUDE_DIRS}" IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" ) endif() endif()