@@ -200,19 +200,21 @@ elseif(
200
200
else ()
201
201
include ("${CMAKE_CURRENT_LIST_DIR} /pybind11NewTools.cmake" )
202
202
203
- message (
204
- "Using compatibility mode for Python, set PYBIND11_FINDPYTHON to NEW/OLD to silence this message"
205
- )
206
- set (PYTHON_EXECUTABLE "${Python_EXECUTABLE} " )
207
- set (PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR} " )
208
- set (Python_INCLUDE_DIRS "${Python_INCLUDE_DIRS} " )
209
- set (PYTHON_LIBRARY "${Python_LIBRARY} " )
210
- set (PYTHON_LIBRARIES "${Python_LIBRARIES} " )
211
- set (PYTHON_VERSION "${Python_VERSION} " )
212
- set (PYTHON_VERSION_STRING "${Python_VERSION_STRING} " )
213
- set (PYTHON_VERSION_MAJOR "${Python_VERSION_MAJOR} " )
214
- set (PYTHON_VERSION_MINOR "${Python_VERSION_MINOR} " )
215
- set (PYTHON_VERSION_PATCH "${Python_VERSION_PATCH} " )
203
+ if (PYBIND11_FINDPYTHON STREQUAL "COMPAT" )
204
+ message (
205
+ "Using compatibility mode for Python, set PYBIND11_FINDPYTHON to NEW/OLD to silence this message"
206
+ )
207
+ set (PYTHON_EXECUTABLE "${Python_EXECUTABLE} " )
208
+ set (PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIR} " )
209
+ set (Python_INCLUDE_DIRS "${Python_INCLUDE_DIRS} " )
210
+ set (PYTHON_LIBRARY "${Python_LIBRARY} " )
211
+ set (PYTHON_LIBRARIES "${Python_LIBRARIES} " )
212
+ set (PYTHON_VERSION "${Python_VERSION} " )
213
+ set (PYTHON_VERSION_STRING "${Python_VERSION_STRING} " )
214
+ set (PYTHON_VERSION_MAJOR "${Python_VERSION_MAJOR} " )
215
+ set (PYTHON_VERSION_MINOR "${Python_VERSION_MINOR} " )
216
+ set (PYTHON_VERSION_PATCH "${Python_VERSION_PATCH} " )
217
+ endif ()
216
218
endif ()
217
219
218
220
else ()
0 commit comments