Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set link_directories for exported Geant4 target #3086

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my education, is this fixing some problem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sawenzel Yes, it ensures consistent usage of the settings as detected (and cached) by cmake. In other words, the build is then fully configured by cmake and does not require the Geant4 environment to compile. Together with alisw/alidist#2121 it also fixes recompilation from the BUILD directory without the aliBuild environment.

Do you see an issue with this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. just wanted to understand the rational.

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