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

google test finds python undermining ability to find python you want #676

Closed
cyrush opened this issue Jan 19, 2024 · 3 comments
Closed

google test finds python undermining ability to find python you want #676

cyrush opened this issue Jan 19, 2024 · 3 comments
Labels

Comments

@cyrush
Copy link
Member

cyrush commented Jan 19, 2024

Not directly a BLT issue, but BLT should protect against this.

With BLT 0.6.0, which is using a newer google test:

Setting up BLT, which then sets up Google Test, causes system python to be found, undermining options to select a specifc python.


-- PRE BLT: PYTHON_EXECUTABLE /Users/harrison37/Work/github/llnl/conduit/uberenv_libs/spack_view/bin/python3

....

-- Google Test Support is ON
-- Google Mock Support is OFF
-- Found Python: /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 (found version "3.9.6") found components: Interpreter 
....

-- POST BLT: PYTHON_EXECUTABLE: /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9
@cyrush cyrush added the bug label Jan 19, 2024
@cyrush
Copy link
Member Author

cyrush commented Jan 19, 2024

Here is the strategy I am using:

################################################################
#! guard against google test's unconditional hunt for python
################################################################
if(DEFINED PYTHON_EXECUTABLE)
    set(_pyexe_guard ${PYTHON_EXECUTABLE})
endif()

set(CMAKE_DISABLE_FIND_PACKAGE_PythonInterp TRUE)
set(CMAKE_DISABLE_FIND_PACKAGE_Python TRUE)
#!##############################################################

################################################################
# init blt using BLT_SOURCE_DIR
################################################################
include(${BLT_SOURCE_DIR}/SetupBLT.cmake)

################################################################
#! guard against google test's unconditional hunt for python
################################################################
set(CMAKE_DISABLE_FIND_PACKAGE_PythonInterp FALSE)
set(CMAKE_DISABLE_FIND_PACKAGE_Python FALSE)

if(DEFINED _pyexe_guard)
    set(PYTHON_EXECUTABLE ${_pyexe_guard})
    unset(_pyexe_guard)
endif()

Setting CMAKE_DISABLE_FIND_PACKAGE_ZZZ isn't sufficient: PYTHON_EXECUTABLE gets cleared when those are set.

@cyrush
Copy link
Member Author

cyrush commented Jan 19, 2024

Grumble, even this isn't sufficient.

@cyrush
Copy link
Member Author

cyrush commented Feb 23, 2024

resolved in #679

@cyrush cyrush closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant