Skip to content

Commit cc9c979

Browse files
authored
[tutorials] suppress cmake warning for find python/sphinx using cmake 3.27 or later (#5924)
* suppress cmake warning for find python/sphinx using cmake 3.27 or later * change module for find python using cmake 3.12 or later * fix variables for new find python package
1 parent 2c28d27 commit cc9c979

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

cmake/Modules/FindSphinx.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@
88
find_package(PkgConfig QUIET)
99
pkg_check_modules(PC_SPHINX sphinx-build)
1010

11-
find_package(PythonInterp)
12-
13-
if(PYTHONINTERP_FOUND)
14-
get_filename_component(PYTHON_DIR "${PYTHON_EXECUTABLE}" PATH)
11+
if(CMAKE_VERSION VERSION_LESS 3.12.0)
12+
find_package(PythonInterp)
13+
if(PYTHONINTERP_FOUND)
14+
get_filename_component(PYTHON_DIR "${PYTHON_EXECUTABLE}" PATH)
15+
endif()
16+
else()
17+
find_package(Python)
18+
if(Python_Interpreter_FOUND)
19+
get_filename_component(PYTHON_DIR "${Python_EXECUTABLE}" PATH)
20+
endif()
1521
endif()
1622

1723
find_program(SPHINX_EXECUTABLE NAMES sphinx-build

0 commit comments

Comments
 (0)