@@ -308,6 +308,26 @@ else()
308308 set (app_flatbuffers_lib flatbuffers)
309309endif ()
310310
311+ # Automatically include headers that might not be declared.
312+ # We use add_compile_options (instead of target_compile_options) so these
313+ # implicit includes apply globally to all targets in this directory,
314+ # including tests. Generator expressions ($<$<COMPILE_LANGUAGE:...>) are
315+ # used to ensure these C/C++ headers are not passed to the Swift compiler.
316+ if (MSVC )
317+ add_compile_options (
318+ $<$<COMPILE_LANGUAGE :CXX >:/FI "assert .h " /FI "string .h " /FI "stdint .h ">)
319+ elseif (APPLE )
320+ add_compile_options (
321+ "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include assert .h >"
322+ "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include string .h >"
323+ "$<$<COMPILE_LANGUAGE :OBJCXX >:SHELL :-include assert .h >"
324+ "$<$<COMPILE_LANGUAGE :OBJCXX >:SHELL :-include string .h >" )
325+ else ()
326+ add_compile_options (
327+ "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include assert .h >"
328+ "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include string .h >" )
329+ endif ()
330+
311331add_library (firebase_app STATIC
312332 ${log_SRCS}
313333 ${log_HDRS}
@@ -367,25 +387,6 @@ target_link_libraries(firebase_app
367387 ${app_flatbuffers_lib}
368388 ${LIBSECRET_LIBRARIES}
369389)
370- # Automatically include headers that might not be declared.
371- # We use add_compile_options (instead of target_compile_options) so these
372- # implicit includes apply globally to all targets in this directory,
373- # including tests. Generator expressions ($<$<COMPILE_LANGUAGE:...>) are
374- # used to ensure these C/C++ headers are not passed to the Swift compiler.
375- if (MSVC )
376- add_compile_options (
377- $<$<COMPILE_LANGUAGE :CXX >:/FI "assert .h " /FI "string .h " /FI "stdint .h ">)
378- elseif (APPLE )
379- add_compile_options (
380- "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include assert .h >"
381- "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include string .h >"
382- "$<$<COMPILE_LANGUAGE :OBJCXX >:SHELL :-include assert .h >"
383- "$<$<COMPILE_LANGUAGE :OBJCXX >:SHELL :-include string .h >" )
384- else ()
385- add_compile_options (
386- "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include assert .h >"
387- "$<$<COMPILE_LANGUAGE :CXX >:SHELL :-include string .h >" )
388- endif ()
389390
390391if (ANDROID )
391392 firebase_cpp_proguard_file (app )
0 commit comments