Skip to content

Commit

Permalink
CMake: Fix Pythia6 detection
Browse files Browse the repository at this point in the history
Defines an imported target "Pythia6". It hides the real library name
which is libpythia6 in alidist and libPythia6 in FairSoft.
  • Loading branch information
dennisklein committed Jul 3, 2019
1 parent 3c320e3 commit e6cd7da
Showing 1 changed file with 25 additions and 38 deletions.
63 changes: 25 additions & 38 deletions cmake/modules/FindPythia6.cmake
Original file line number Diff line number Diff line change
@@ -1,43 +1,30 @@
################################################################################
# Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################
# - Try to find PLUTO instalation
# Once done this will define
#
# Pythia6_FOUND - system has Pythia6
# Pythia6_LIBRARY_DIR - The libraries directory for Pythia6
#
################################################################################
# Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
# copied verbatim in the file "LICENSE" #
################################################################################

#MESSAGE(STATUS "Looking for Pythia6...")
find_library(Pythia6_LIBRARY
NAMES Pythia6 pythia6
HINTS "${PYTHIA6_ROOT}" "${Pythia6_LIBRARY_DIR}"
PATH_SUFFIXES lib
)

FIND_PATH(Pythia6_LIBRARY_DIR NAMES libPythia6.so libPythia6.dylib PATHS
$ENV{PYTHIA6_ROOT}/lib
${Pythia6_DIR}/lib
${AlFa_DIR}/lib
${SIMPATH}/lib
${SIMPATH}/generators/lib
NO_DEFAULT_PATH
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Pythia6
REQUIRED_VARS Pythia6_LIBRARY
)

if (Pythia6_LIBRARY_DIR)
set(Pythia6_FOUND TRUE)
Set(PYTHIA6_LIBRARY_DIR ${Pythia6_LIBRARY_DIR})
endif(Pythia6_LIBRARY_DIR)
if(Pythia6_FOUND)
get_filename_component(Pythia6_LIBRARY_DIR ${Pythia6_LIBRARY} DIRECTORY)
set(PYTHIA6_LIBRARY_DIR ${Pythia6_LIBRARY_DIR}) # legacy

if (Pythia6_FOUND)
SET(Pythia6_ROOT ${Pythia6_LIBRARY_DIR})
if (NOT Pythia6_FIND_QUIETLY)
MESSAGE(STATUS "Looking for Pythia6... - found ${Pythia6_LIBRARY_DIR}")
SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${Pythia6_LIBRARY_DIR})
MESSAGE(STATUS "Looking for Pythia6... - Lib in ${Pythia6_LIBRARY_DIR}")
MESSAGE(STATUS "Looking for Pythia6... - found ${Pythia6_VERSION}")
endif (NOT Pythia6_FIND_QUIETLY)
else (Pythia6_FOUND)
if (Pythia6_FIND_REQUIRED)
message(FATAL_ERROR "Looking for Pythia6... - Not found")
endif (Pythia6_FIND_REQUIRED)
endif (Pythia6_FOUND)
if(NOT TARGET Pythia6)
add_library(Pythia6 UNKNOWN IMPORTED)
set_target_properties(Pythia6 PROPERTIES
IMPORTED_LOCATION ${Pythia6_LIBRARY}
)
endif()
endif()

0 comments on commit e6cd7da

Please sign in to comment.