From 87506e6ad6f4dcd867995f628ff54e4ec6b8329d Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Thu, 14 Nov 2024 12:02:17 -0800 Subject: [PATCH] Don't force-set Python cache variables Allow the user to override Python paths from the command line. --- cmake_modules/IMPFindPython.cmake | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cmake_modules/IMPFindPython.cmake b/cmake_modules/IMPFindPython.cmake index 4244c2a7b3..b1ed3b500c 100644 --- a/cmake_modules/IMPFindPython.cmake +++ b/cmake_modules/IMPFindPython.cmake @@ -4,18 +4,18 @@ function(imp_find_python) if(Python3_Interpreter_FOUND AND Python3_Development_FOUND) # Use Python 3 tools - set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE INTERNAL "" FORCE) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE STRING "") set(PYTHON_TEST_EXECUTABLE ${Python3_EXECUTABLE} CACHE STRING "") - set(PYTHON_LIBRARIES ${Python3_LIBRARIES} CACHE INTERNAL "" FORCE) - set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS} CACHE INTERNAL "" FORCE) - set(PYTHON_LIBRARY_DIRS ${Python3_LIBRARY_DIRS} CACHE INTERNAL "" FORCE) - set(PYTHON_NUMPY_FOUND ${Python3_NumPy_FOUND} CACHE INTERNAL "" FORCE) + set(PYTHON_LIBRARIES ${Python3_LIBRARIES} CACHE STRING "") + set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS} CACHE STRING "") + set(PYTHON_LIBRARY_DIRS ${Python3_LIBRARY_DIRS} CACHE STRING "") + set(PYTHON_NUMPY_FOUND ${Python3_NumPy_FOUND} CACHE STRING "") set(PYTHON_NUMPY_INCLUDE_DIR ${Python3_NumPy_INCLUDE_DIRS} - CACHE INTERNAL "" FORCE) - set(PYTHON_VERSION ${Python3_VERSION} CACHE INTERNAL "" FORCE) - set(PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR} CACHE INTERNAL "" FORCE) - set(PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR} CACHE INTERNAL "" FORCE) - set(PYTHON_VERSION_PATCH ${Python3_VERSION_PATCH} CACHE INTERNAL "" FORCE) + CACHE STRING "") + set(PYTHON_VERSION ${Python3_VERSION} CACHE STRING "") + set(PYTHON_VERSION_MAJOR ${Python3_VERSION_MAJOR} CACHE STRING "") + set(PYTHON_VERSION_MINOR ${Python3_VERSION_MINOR} CACHE STRING "") + set(PYTHON_VERSION_PATCH ${Python3_VERSION_PATCH} CACHE STRING "") else() message(FATAL_ERROR "Could not find a Python interpreter and matching headers/libraries. Python is required to build.") endif()