aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/core/src/firebase/firestore/util/CMakeLists.txt')
-rw-r--r--Firestore/core/src/firebase/firestore/util/CMakeLists.txt45
1 files changed, 43 insertions, 2 deletions
diff --git a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
index 7283942..737173b 100644
--- a/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
+++ b/Firestore/core/src/firebase/firestore/util/CMakeLists.txt
@@ -16,11 +16,12 @@
# libraries in here are an implementation detail of making this a
# mutli-platform build.
+include(CheckSymbolExists)
+include(CheckIncludeFiles)
+
cc_library(
firebase_firestore_util_base
SOURCES
- secure_random.h
- secure_random_arc4random.cc
string_printf.cc
string_printf.h
DEPENDS
@@ -60,15 +61,55 @@ else()
endif()
+## secure_random
+
+check_symbol_exists(arc4random stdlib.h HAVE_ARC4RANDOM)
+cc_library(
+ firebase_firestore_util_arc4random
+ SOURCES
+ secure_random_arc4random.cc
+)
+
+get_target_property(
+ CMAKE_REQUIRED_INCLUDES
+ OpenSSL::Crypto INTERFACE_INCLUDE_DIRECTORIES
+)
+check_include_files(openssl/rand.h HAVE_OPENSSL_RAND_H)
+cc_library(
+ firebase_firestore_util_openssl
+ SOURCES
+ secure_random_openssl.cc
+ DEPENDS
+ OpenSSL::Crypto
+)
+
+if(HAVE_ARC4RANDOM)
+ list(APPEND UTIL_DEPENDS firebase_firestore_util_arc4random)
+
+elseif(HAVE_OPENSSL_RAND_H)
+ list(APPEND UTIL_DEPENDS firebase_firestore_util_openssl)
+
+else()
+ message(FATAL_ERROR "No implementation for SecureRandom available.")
+
+endif()
+
+
## main library
+configure_file(
+ config.h.in
+ config.h
+)
cc_library(
firebase_firestore_util
SOURCES
autoid.cc
autoid.h
+ config.h
firebase_assert.h
log.h
+ secure_random.h
DEPENDS
${UTIL_DEPENDS}
firebase_firestore_util_base