Skip to content

Commit 88ad013

Browse files
authored
CMakeLists.txt: Add FIREBASE_FLATC_CMAKE_COMMAND (#1103)
1 parent a807a3e commit 88ad013

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -524,13 +524,20 @@ else()
524524
set(ENV_COMMAND env -i PATH=${firebase_command_line_path})
525525
endif()
526526

527+
# The cmake executable to use when compiling flatc. Normally, the default
528+
# value (finding cmake in the PATH) is fine; however, in cases where cmake is
529+
# *not* in the PATH (e.g. when building from CLion using the Android
530+
# toolchain) it must be specified via via this cache variable.
531+
set(FIREBASE_FLATC_CMAKE_COMMAND "cmake" CACHE FILEPATH
532+
"The cmake command to use when compiling flatc.")
533+
527534
# Build flatc by invoking the cmake build, with only the flatc target.
528535
file(MAKE_DIRECTORY ${firebase_external_flatc_build_dir})
529536
add_custom_command(
530537
OUTPUT ${firebase_external_flatc}
531538
COMMAND cd ${firebase_external_flatc_build_dir} ${COMMAND_CONCAT}
532-
${ENV_COMMAND} cmake ${FLATBUFFERS_SOURCE_DIR} ${COMMAND_CONCAT}
533-
${ENV_COMMAND} cmake --build . --target flatc
539+
${ENV_COMMAND} ${FIREBASE_FLATC_CMAKE_COMMAND} ${FLATBUFFERS_SOURCE_DIR} ${COMMAND_CONCAT}
540+
${ENV_COMMAND} ${FIREBASE_FLATC_CMAKE_COMMAND} --build . --target flatc
534541
COMMENT "Building flatc (the FlatBuffer schema compiler)")
535542

536543
# Add a target so that we can run the custom commands before the code build.

0 commit comments

Comments
 (0)