Skip to content

Commit

Permalink
Merge branch 'fix-old-cmake-build-error' into 'master'
Browse files Browse the repository at this point in the history
fix(build): fix after flatc build over to run python code

See merge request third-party/flatbuffers!4
  • Loading branch information
chenqy4933 committed Jun 9, 2022
2 parents f5cc333 + 31ff4eb commit d60ddc5
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions CMake/CMakeLists_legacy.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -545,33 +545,6 @@ function(compile_flatbuffers_schema_to_embedded_binary SRC_FBS OPT)
register_generated_output(${GEN_BFBS_HEADER})
endfunction()

# 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))
set(GENERATION_SCRIPT ${PYTHON_EXECUTABLE} scripts/generate_code.py)
if(FLATBUFFERS_BUILD_LEGACY)
# Need to set --cpp-std c++-0x options
set(GENERATION_SCRIPT ${GENERATION_SCRIPT} --cpp-0x)
endif()
if(FLATBUFFERS_SKIP_MONSTER_EXTRA)
set(GENERATION_SCRIPT ${GENERATION_SCRIPT} --skip-monster-extra)
endif()
add_custom_command(
TARGET flatc
POST_BUILD
COMMAND ${GENERATION_SCRIPT} --flatc "${FLATBUFFERS_FLATC_EXECUTABLE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running ${GENERATION_SCRIPT}..."
VERBATIM)
else()
message("No Python3 interpreter found! Unable to generate files automatically.")
endif()

if(FLATBUFFERS_BUILD_TESTS)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/samples" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
Expand Down

0 comments on commit d60ddc5

Please sign in to comment.