Skip to content

Commit 7526abc

Browse files
committed
depend directly on the flatc binary instead of the project
1 parent fa88c12 commit 7526abc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

CMakeLists.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ if(EXECUTORCH_BUILD_FLATC)
497497
# Build flatc for the *host* to generate files as part of the build step.
498498
include(ExternalProject)
499499
ExternalProject_Add(
500-
flatc
500+
flatbuffers
501501
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/third-party/flatbuffers
502502
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/third-party/flatbuffers
503503
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third-party/flatbuffers
@@ -510,8 +510,9 @@ if(EXECUTORCH_BUILD_FLATC)
510510
-DCMAKE_CXX_FLAGS="-DFLATBUFFERS_MAX_ALIGNMENT=${FLATBUFFERS_MAX_ALIGNMENT}"
511511
INSTALL_COMMAND ""
512512
)
513-
ExternalProject_Get_Property(flatc BINARY_DIR)
513+
ExternalProject_Get_Property(flatbuffers BINARY_DIR)
514514
set(FLATC_EXECUTABLE ${BINARY_DIR}/flatc)
515+
set(FLATC_EXECUTABLE_BUILT_FROM_SOURCE YES)
515516
endif()
516517

517518
if(NOT FLATC_EXECUTABLE)
@@ -530,6 +531,13 @@ if(NOT FLATC_EXECUTABLE)
530531
endif()
531532
endif()
532533

534+
add_executable(flatc IMPORTED GLOBAL)
535+
set_target_properties(flatc PROPERTIES IMPORTED_LOCATION ${FLATC_EXECUTABLE})
536+
537+
if(FLATC_EXECUTABLE_BUILT_FROM_SOURCE)
538+
add_dependencies(flatc flatbuffers)
539+
endif()
540+
533541
#
534542
# program_schema: Generated .h files from schema/*.fbs inputs
535543
#

0 commit comments

Comments
 (0)