Skip to content

Commit ecccb23

Browse files
authored
Merge pull request #247 from firebase/am-flatbuffers-fix
Include Flatbuffers as source when building for mobile
2 parents bb52e30 + 13b5a77 commit ecccb23

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

app/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,15 @@ else()
298298
"${app_desktop_HDRS}")
299299
endif()
300300

301+
if(ANDROID OR IOS)
302+
# If building for Android or iOS, include the Flatbuffers source files directly.
303+
set(app_flatbuffers_srcs ${FlatBuffers_Library_SRCS})
304+
set(app_flatbuffers_lib)
305+
else()
306+
set(app_flatbuffers_srcs)
307+
set(app_flatbuffers_lib flatbuffers)
308+
endif()
309+
301310
add_library(firebase_app STATIC
302311
${log_SRCS}
303312
${log_HDRS}
@@ -311,7 +320,8 @@ add_library(firebase_app STATIC
311320
memory/atomic.h
312321
meta/move.h
313322
memory/unique_ptr.h
314-
memory/shared_ptr.h)
323+
memory/shared_ptr.h
324+
${app_flatbuffers_srcs})
315325

316326
set_property(TARGET firebase_app PROPERTY FOLDER "Firebase Cpp")
317327

@@ -339,7 +349,7 @@ target_compile_definitions(firebase_app
339349
# firebase_app has a dependency on flatbuffers, which needs to be included.
340350
target_link_libraries(firebase_app
341351
PRIVATE
342-
flatbuffers
352+
${app_flatbuffers_lib}
343353
${LIBSECRET_LIBRARIES}
344354
)
345355
# Automatically include headers that might not be declared.

0 commit comments

Comments
 (0)