Page MenuHomeHEPForge

No OneTemporary

diff --git a/cmake/Modules/Findrivet.cmake b/cmake/Modules/Findrivet.cmake
index cd7d2ec..05ab9fb 100644
--- a/cmake/Modules/Findrivet.cmake
+++ b/cmake/Modules/Findrivet.cmake
@@ -1,27 +1,227 @@
-include (FindPackageMessage)
-
-message (STATUS "Detecting rivet installation")
-execute_process (COMMAND rivet-config --prefix
- OUTPUT_VARIABLE rivet_PREFIX
- )
-if (rivet_PREFIX)
- string (STRIP ${rivet_PREFIX} rivet_PREFIX)
- message (STATUS "rivet installation found: ${rivet_PREFIX}")
- EXECUTE_PROCESS(COMMAND rivet-config --libs OUTPUT_VARIABLE
- rivet_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
- # set (rivet_INCLUDE_PATH ${rivet_PREFIX}/include)
- EXECUTE_PROCESS(COMMAND rivet-config --includedir OUTPUT_VARIABLE
- rivet_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
- set (rivet_FOUND TRUE)
-else (rivet_PREFIX)
- set (rivet_FOUND FALSE)
-endif (rivet_PREFIX)
-
-if (NOT rivet_FOUND)
- message(STATUS "rivet installation not found!")
-endif (NOT rivet_FOUND)
-
-mark_as_advanced(
- rivet_INCLUDE_PATH
- rivet_LIBRARIES
+# 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}
+ )
+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()

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jan 21, 1:43 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4223833
Default Alt Text
(9 KB)

Event Timeline