Skip to content

Commit db22a07

Browse files
committed
Rename FIRESTORE_TESTS_CMAKE_BUILD to FIREBASE_TESTS_BUILT_BY_CMAKE and move the target_compile_definitions into the firebase_ios_add_test() cmake function
1 parent 142325a commit db22a07

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Firestore/core/test/unit/local/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ firebase_ios_glob(
4242
)
4343
firebase_ios_add_test(firestore_local_test ${sources})
4444

45-
# Set a preprocessor define so that tests can distinguish between having been
46-
# built by Xcode vs. cmake.
47-
target_compile_definitions(
48-
firestore_local_test
49-
PRIVATE
50-
FIRESTORE_TESTS_CMAKE_BUILD
51-
)
52-
5345
target_link_libraries(
5446
firestore_local_test PRIVATE
5547
GMock::GMock

Firestore/core/test/unit/local/leveldb_snappy_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Path CreateLevelDbDatabaseThatUsesSnappyCompression();
4949
void IterateOverLevelDbDatabaseThatUsesSnappyCompression(
5050
std::function<void(const leveldb::Status&)>);
5151

52-
#if FIRESTORE_TESTS_CMAKE_BUILD
52+
#if FIREBASE_TESTS_BUILT_BY_CMAKE
5353

5454
// Ensure that LevelDb is compiled with Snappy compression support.
5555
// See https://github.com/firebase/firebase-ios-sdk/pull/9596 for details.
@@ -60,7 +60,7 @@ TEST(LevelDbSnappy, LevelDbSupportsSnappy) {
6060
});
6161
}
6262

63-
#else // FIRESTORE_TESTS_CMAKE_BUILD
63+
#else // FIREBASE_TESTS_BUILT_BY_CMAKE
6464

6565
// Ensure that LevelDb is NOT compiled with Snappy compression support.
6666
TEST(LevelDbSnappy, LevelDbDoesNotSupportSnappy) {
@@ -81,7 +81,7 @@ TEST(LevelDbSnappy, LevelDbDoesNotSupportSnappy) {
8181
}
8282
}
8383

84-
#endif // FIRESTORE_TESTS_CMAKE_BUILD
84+
#endif // FIREBASE_TESTS_BUILT_BY_CMAKE
8585

8686
void IterateOverLevelDbDatabaseThatUsesSnappyCompression(
8787
std::function<void(const leveldb::Status&)> callback) {

cmake/cc_rules.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ function(firebase_ios_add_test target)
116116

117117
firebase_ios_set_common_target_options(${target} ${flag_OPTIONS})
118118

119+
# Set a preprocessor define so that tests can distinguish between having been
120+
# built by Xcode vs. cmake.
121+
target_compile_definitions(
122+
${target}
123+
PRIVATE
124+
FIREBASE_TESTS_BUILT_BY_CMAKE
125+
)
126+
119127
target_link_libraries(${target} PRIVATE GTest::GTest GTest::Main)
120128
endfunction()
121129

0 commit comments

Comments
 (0)