Skip to content

Commit ce42c4d

Browse files
authored
fix(cmake): avoid message if FINDPYTHON NEW (#5656)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent d7d782c commit ce42c4d

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

tools/pybind11Common.cmake

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,21 @@ elseif(
200200
else()
201201
include("${CMAKE_CURRENT_LIST_DIR}/pybind11NewTools.cmake")
202202

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()
216218
endif()
217219

218220
else()

0 commit comments

Comments
 (0)