Skip to content
Snippets Groups Projects
Commit 1d44bd0c authored by Pere Mato Vila's avatar Pere Mato Vila
Browse files

Added option pythia6_nolink (CMake) to postpone linking with pythia6 library. Fixes ROOT-5802

parent 326d0059
No related branches found
No related tags found
No related merge requests found
# Find the Pythia6 includes and library.
#
# This module defines
# PYTHIA6_LIBRARIES, the libraries to link against to use Pythia6
# PYTHIA6_FOUND. If false, you cannot build anything that requires Pythia6.
# PYTHIA6_LIBRARY, where to find the libPythia6 library.
# - Locate pythia6 library
# Defines:
#
# PYTHIA6_FOUND
# PYTHIA6_INCLUDE_DIR
# PYTHIA6_INCLUDE_DIRS (not cached)
# PYTHIA6_LIBRARY
# PYTHIA6_LIBRARY_DIR (not cached)
# PYTHIA6_LIBRARIES (not cached)
set(PYTHIA6_FOUND 0)
find_library(PYTHIA6_LIBRARY NAMES pythia6 Pythia6 PATHS
$ENV{PYTHIA6_DIR}/lib
/cern/pro/lib
set(CMAKE_LIBRARY_PATH
/cern/pro/lib
/opt/pythia
/opt/pythia6
/usr/lib/pythia
......@@ -18,16 +17,19 @@ find_library(PYTHIA6_LIBRARY NAMES pythia6 Pythia6 PATHS
/usr/lib/pythia6
/usr/local/lib/pythia6
/usr/lib
/usr/local/lib
DOC "Specify the Pythia6 library here."
)
/usr/local/lib)
if(PYTHIA6_LIBRARY)
message(STATUS "Found Pythia6 library at ${PYTHIA6_LIBRARY}")
set(PYTHIA6_FOUND 1 )
endif()
find_library(PYTHIA6_LIBRARY NAMES pythia6 Pythia6
HINTS $ENV{PYTHIA6_DIR}/lib ${PYTHIA6_DIR}/lib)
set(PYTHIA6_LIBRARIES ${PYTHIA6_LIBRARY})
get_filename_component(PYTHIA6_LIBRARY_DIR ${PYTHIA6_LIBRARY} PATH)
# handle the QUIETLY and REQUIRED arguments and set PHOTOS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pythia6 DEFAULT_MSG PYTHIA6_LIBRARY)
MARK_AS_ADVANCED( PYTHIA6_FOUND PYTHIA6_LIBRARY)
mark_as_advanced(PYTHIA6_FOUND PYTHIA6_LIBRARY)
......@@ -116,6 +116,7 @@ ROOT_BUILD_OPTION(pch ON)
ROOT_BUILD_OPTION(peac ON "PEAC, PROOF Enabled Analysis Center, requires Clarens")
ROOT_BUILD_OPTION(pgsql ON "PostgreSQL support, requires libpq")
ROOT_BUILD_OPTION(pythia6 ON "Pythia6 EG support, requires libPythia6")
ROOT_BUILD_OPTION(pythia6_nolink OFF "Delayed linking of Pythia6 library")
ROOT_BUILD_OPTION(pythia8 ON "Pythia8 EG support, requires libPythia8")
ROOT_BUILD_OPTION(python ON "Python ROOT bindings, requires python >= 2.2")
ROOT_BUILD_OPTION(qt OFF "Qt graphics backend, requires libqt >= 4.x")
......
......@@ -450,8 +450,8 @@ endif()
#---Check for Pythia6-------------------------------------------------------------------
if(pythia6)
message(STATUS "Looking for Pythia6")
find_package(Pythia6)
if(NOT PYTHIA6_FOUND)
find_package(Pythia6 QUIET)
if(NOT PYTHIA6_FOUND AND NOT pythia6_nolink)
if(fail-on-missing)
message(FATAL_ERROR "Pythia6 libraries not found and they are required (pythia6 option enabled)")
else()
......
......@@ -9,5 +9,11 @@ ROOT_USE_PACKAGE(math/physics)
ROOT_GENERATE_DICTIONARY(G__Pythia6 *.h LINKDEF LinkDef.h)
ROOT_GENERATE_ROOTMAP(EGPythia6 LINKDEF LinkDef.h DEPENDENCIES EG Graf VMC Physics )
ROOT_LINKER_LIBRARY(EGPythia6 *.cxx G__Pythia6.cxx LIBRARIES Core ${PYTHIA6_LIBRARIES} DEPENDENCIES EG Graf VMC Physics)
if(pythia6_nolink)
string(REGEX REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
ROOT_LINKER_LIBRARY(EGPythia6 *.cxx G__Pythia6.cxx LIBRARIES Core DEPENDENCIES EG Graf VMC Physics)
else()
ROOT_LINKER_LIBRARY(EGPythia6 *.cxx G__Pythia6.cxx LIBRARIES Core ${PYTHIA6_LIBRARIES} DEPENDENCIES EG Graf VMC Physics)
endif()
ROOT_INSTALL_HEADERS()
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