Use ${PYTHON_EXECUTABLE} instead of py in cmake (#7042)

* Emit include for bfbs-gen-embed

* Use python3 explicitly

* bump min python version to 3.6

* Sort find_package for python

* try casting Path to string

* cast WindowsPath to string to please CI

* stringify the wrong thing

* another stringify path
This commit is contained in:
Derek Bailey
2022-01-28 15:00:57 -08:00
committed by GitHub
parent 028f0fde62
commit dbbaeac85c
2 changed files with 9 additions and 9 deletions

View File

@@ -526,16 +526,16 @@ function(compile_flatbuffers_schema_to_embedded_binary SRC_FBS OPT)
register_generated_output(${GEN_BFBS_HEADER})
endfunction()
# Look if we have python 3 installed so that we can run the generate code python
# script after flatc is built.
find_package(PythonInterp 3)
# Look if we have python 3.5 installed so that we can run the generate code
# python script after flatc is built.
find_package(PythonInterp 3.5)
if(PYTHONINTERP_FOUND AND
# Skip doing this if the MSVC version is below VS 12.
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
(NOT MSVC OR MSVC_VERSION GREATER 1800))
if(MSVC)
set(GENERATION_SCRIPT py scripts/generate_code.py)
set(GENERATION_SCRIPT ${PYTHON_EXECUTABLE} scripts/generate_code.py)
else()
set(GENERATION_SCRIPT scripts/generate_code.py)
endif()