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

Make sure to find stack python before system python #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tmadlener
Copy link
Contributor

Putting find_package(Gaudi) at the top makes that find python first, which will find the python from the Key4hep stack. Otherwise another package might find the system python first, which is not necessarily suitable for building this.

BEGINRELEASENOTES

  • Make sure to prefer the Key4hep built python over the system python when calling cmake

ENDRELEASENOTES

Putting `find_package(Gaudi)` at the top makes that find python first, which will find the python from the Key4hep stack. Otherwise another package might find the system python first, which is not necessarily suitable for building this.
@tmadlener tmadlener closed this Feb 4, 2025
@tmadlener tmadlener reopened this Feb 4, 2025
@jmcarcell
Copy link
Member

This will not work if headers are installed for the system python. I think there should be a better way because this happens from time to time in different repos. One option could be to set environment variables in the stack pointing to the python installation.
A change in the CMake config like this also works, but then this also has to be fixed for every repository:

execute_process(
    COMMAND which python3
    OUTPUT_VARIABLE PYTHON_FROM_PATH
    OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(Python_EXECUTABLE ${PYTHON_FROM_PATH})
find_package(Python REQUIRED)

@tmadlener
Copy link
Contributor Author

Yeah, it's a bit annoying. What if we put it into the common cmake config without find_package(Python)? If we ensure that that is called early enough, I think all subsequent find_package calls should do the right thing, and we have it centrally managed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants