@@ -471,10 +471,9 @@ cmake_dependent_option(
471
471
#
472
472
cmake_dependent_option(
473
473
EXECUTORCH_BUILD_FLATC "Build the flatc executable." ON
474
- "NOT FLATC_EXECUTABLE;EXECUTORCH_BUILD_HOST_TARGETS " OFF
474
+ "NOT FLATC_EXECUTABLE" OFF
475
475
)
476
476
477
-
478
477
set (FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "" )
479
478
set (FLATBUFFERS_BUILD_FLATHASH OFF CACHE BOOL "" )
480
479
set (FLATBUFFERS_BUILD_FLATLIB OFF CACHE BOOL "" )
@@ -507,6 +506,9 @@ if(EXECUTORCH_BUILD_FLATC)
507
506
-DFLATBUFFERS_BUILD_TESTS=${FLATBUFFERS_BUILD_TESTS}
508
507
-DFLATBUFFERS_INSTALL=${FLATBUFFERS_INSTALL}
509
508
-DCMAKE_CXX_FLAGS="-DFLATBUFFERS_MAX_ALIGNMENT=${FLATBUFFERS_MAX_ALIGNMENT} "
509
+ # Flags "unset" to prevent platform flags from being propagated.
510
+ $<$<BOOL :${CMAKE_TOOLCHAIN_IOS} >:-DCMAKE_TOOLCHAIN_FILE=>
511
+ $<$<BOOL :${CMAKE_TOOLCHAIN_IOS} >:-DCMAKE_OSX_SYSROOT=>
510
512
INSTALL_COMMAND ""
511
513
BUILD_BYPRODUCTS <BINARY_DIR>/flatc
512
514
)
@@ -515,6 +517,8 @@ if(EXECUTORCH_BUILD_FLATC)
515
517
# flatbuffers does not use CMAKE_BUILD_TYPE. Internally, the build forces Release
516
518
# config, but from CMake's perspective the build type is always Debug.
517
519
set (FLATC_EXECUTABLE ${BINARY_DIR} /$<CONFIG>/flatc.exe)
520
+ elseif (CMAKE_TOOLCHAIN_IOS)
521
+ set (FLATC_EXECUTABLE ${BINARY_DIR} /$<CONFIG>/flatc)
518
522
else ()
519
523
set (FLATC_EXECUTABLE ${BINARY_DIR} /flatc)
520
524
endif ()
@@ -528,12 +532,7 @@ if(NOT FLATC_EXECUTABLE)
528
532
find_program (FLATC_EXECUTABLE flatc)
529
533
530
534
if (NOT FLATC_EXECUTABLE)
531
- message (
532
- FATAL_ERROR
533
- "FLATC_EXECUTABLE must be set when EXECUTORCH_BUILD_FLATC is disabled. "
534
- "Note that EXECUTORCH_BUILD_FLATC may be disabled implicitly when "
535
- "cross-compiling or when EXECUTORCH_BUILD_HOST_TARGETS is disabled."
536
- )
535
+ message (FATAL_ERROR "FLATC_EXECUTABLE must be set when EXECUTORCH_BUILD_FLATC is disabled." )
537
536
endif ()
538
537
endif ()
539
538
0 commit comments