Skip to content

Commit b63aeb0

Browse files
authored
Merge pull request #31020 from compnerd/python-fallback
build: add a workaround for the build to use Python2 instead of Python3
2 parents 8c42386 + 45d54b6 commit b63aeb0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,13 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
893893
endif()
894894

895895
find_package(Python2 COMPONENTS Interpreter REQUIRED)
896-
find_package(Python3 COMPONENTS Interpreter REQUIRED)
896+
find_package(Python3 COMPONENTS Interpreter)
897+
if(NOT Python3_Interpreter_FOUND)
898+
message(WARNING "Python3 not found, using python2 as a fallback")
899+
add_executable(Python3::Interpreter IMPORTED)
900+
set_target_properties(Python3::Interpreter PROPERTIES
901+
IMPORTED_LOCATION ${Python2_EXECUTABLE})
902+
endif()
897903

898904
#
899905
# Find optional dependencies.

0 commit comments

Comments
 (0)