about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoman Gershman <romange@gmail.com>2017-12-22T22·25+0200
committerRoman Gershman <romange@gmail.com>2017-12-22T22·25+0200
commit765541cd5e964396bc22f19ae688599663edeeb9 (patch)
treeafd2d64c20e18092a5bf2cd696800d411cf22c3a
parentff7045647330f5dc21725a42456091207f3eecd5 (diff)
Relax dependency on googletest and allow customization of cctz target
-rw-r--r--CMakeLists.txt35
-rw-r--r--absl/time/CMakeLists.txt2
2 files changed, 21 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c65805ebdfbd..52acb361ffa8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,29 +58,34 @@ list(APPEND ABSL_COMMON_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
 set(CMAKE_CXX_FLAGS "${ABSL_STD_CXX_FLAG} ${CMAKE_CXX_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_WARNING_VLA} ${CMAKE_CXX_FLAGS} ")
 
-
 # find dependencies
 ## pthread
 find_package(Threads REQUIRED)
 
+if(NOT CCTZ_TARGET)
+  set(CCTZ_TARGET cctz)
+endif()
+
 # commented: used only for standalone test
 #add_subdirectory(cctz)
 #add_subdirectory(googletest)
+check_target({${CCTZ_TARGET})
 
 ## check targets
-check_target(cctz)
-check_target(gtest)
-check_target(gtest_main)
-check_target(gmock)
-
-# -fexceptions
-set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")
-
-list(APPEND ABSL_TEST_COMMON_LIBRARIES
-  gtest_main
-  gtest
-  gmock
-  ${CMAKE_THREAD_LIBS_INIT}
-)
+if(BUILD_TESTING)
+  check_target(gtest)
+  check_target(gtest_main)
+  check_target(gmock)
+
+  # -fexceptions
+  set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")
+
+  list(APPEND ABSL_TEST_COMMON_LIBRARIES
+    gtest_main
+    gtest
+    gmock
+    ${CMAKE_THREAD_LIBS_INIT}
+  )
+endif()
 
 add_subdirectory(absl)
diff --git a/absl/time/CMakeLists.txt b/absl/time/CMakeLists.txt
index 60f61483e9a3..5ee5d0b35534 100644
--- a/absl/time/CMakeLists.txt
+++ b/absl/time/CMakeLists.txt
@@ -32,7 +32,7 @@ list(APPEND TIME_SRC
   ${TIME_PUBLIC_HEADERS}
   ${TIME_INTERNAL_HEADERS}
 )
-set(TIME_PUBLIC_LIBRARIES absl::base absl::stacktrace absl::int128 cctz)
+set(TIME_PUBLIC_LIBRARIES absl::base absl::stacktrace absl::int128 {CCTZ_TARGET})
 
 absl_library(
   TARGET