Skip to content

Commit

Permalink
Set link_directories for exportet Geant4 target
Browse files Browse the repository at this point in the history
  • Loading branch information
qgp committed Mar 10, 2020
1 parent a824d91 commit f3c0856
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dependencies/FindGeant4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ set_target_properties(geant4
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
"${Geant4_INCLUDE_DIRS}")

list(GET Geant4_INCLUDE_DIRS 0 Geant4_INCLUDE_DIR)
set(Geant4_LIBRARY_DIRS)
foreach(gl4lib IN LISTS Geant4_LIBRARIES)
find_library(gl4libpath NAMES ${gl4lib} PATHS "${Geant4_INCLUDE_DIR}/../.."
PATH_SUFFIXES lib lib64
NO_DEFAULT_PATH)
if(gl4libpath)
get_filename_component(gl4libdir ${gl4libpath} DIRECTORY)
list(APPEND Geant4_LIBRARY_DIRS ${gl4libdir})
endif()
unset(gl4libpath CACHE)
endforeach()
list(REMOVE_DUPLICATES Geant4_LIBRARY_DIRS)
set_target_properties(geant4
PROPERTIES INTERFACE_LINK_DIRECTORIES
"${Geant4_LIBRARY_DIRS}")

# Promote the imported target to global visibility
# (so we can alias it)
set_target_properties(geant4 PROPERTIES IMPORTED_GLOBAL TRUE)
Expand Down

0 comments on commit f3c0856

Please sign in to comment.