aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2018-01-03 07:00:54 -0800
committerGravatar GitHub <noreply@github.com>2018-01-03 07:00:54 -0800
commit5a6155f6a38a2d5515667406a5926c39753627e5 (patch)
treeda3395a715b01841cd8ae9d52d85cbfb6d0049b8 /Firestore/core/src/firebase/firestore/util/CMakeLists.txt
parent727edcead2b7620dcd0c586352486370e15ffa45 (diff)
Build and test both C++ loggers where possible (#595)
* Rename FIREBASE_BINARY_DIR to FIREBASE_INSTALL_DIR Make this consistent with the outer superbuild and also make the association with CMAKE_INSTALL_PREFIX more obvious. * Build and test log_stdio separate from the rest of util This is in preparation for adding a test for log_apple * Build and test log_apple under CMake Also add notes about how FIRLogger's debug mode can break this test * Refactor log_apple to cut down duplicate switch statements There's also a slight reduction in final binary size.
Diffstat (limited to 'Firestore/core/src/firebase/firestore/util/CMakeLists.txt')
-rw-r--r--Firestore/core/src/firebase/firestore/util/CMakeLists.txt43
1 files changed, 42 insertions, 1 deletions
diff --git a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
index ebb2301..d70397d 100644
--- a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
+++ b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
@@ -15,6 +15,47 @@
add_library(
firebase_firestore_util
autoid.cc
- log_stdio.cc
secure_random_arc4random.cc
)
+
+# log_stdio can be built and tested everywhere
+add_library(
+ firebase_firestore_util_log_stdio
+ log_stdio.cc
+)
+
+# log_apple can only built and tested on apple plaforms
+if(APPLE)
+ add_library(
+ firebase_firestore_util_log_apple
+ log_apple.mm
+ )
+ target_compile_options(
+ firebase_firestore_util_log_apple
+ PRIVATE
+ ${OBJC_FLAGS}
+ )
+ target_link_libraries(
+ firebase_firestore_util_log_apple
+ PUBLIC
+ FirebaseCore
+ )
+endif(APPLE)
+
+# Export a dependency on the correct logging library for this platform. All
+# buildable libraries are built and tested but only the best fit is exported.
+if(APPLE)
+ target_link_libraries(
+ firebase_firestore_util
+ PUBLIC
+ firebase_firestore_util_log_apple
+ )
+
+else(NOT APPLE)
+ target_link_libraries(
+ firebase_firestore_util
+ PUBLIC
+ firebase_firestore_util_log_stdio
+ )
+
+endif(APPLE)