about summary refs log tree commit diff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJonathan Cohen <cohenjon@google.com>2018-01-30T20·06-0500
committerGitHub <noreply@github.com>2018-01-30T20·06-0500
commite5c6ee2d0032d08f4d7a4680c13b9e2e5787ac26 (patch)
tree3ecc27314a5d867dd342fed5b1ad831539995ffa /CMakeLists.txt
parent43801dbd39664da291e24a63c86b4ed82069a0f6 (diff)
parent10c79457fca05df92319235eab6e75c56adc841b (diff)
Merge pull request #69 from romange/master
Relax dependency requirements for google test library and allow customization of cctz target
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt33
1 files changed, 19 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d3262393317..6d3789e8031c 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} ")
 
+# -fexceptions
+set(ABSL_EXCEPTIONS_FLAG "${CMAKE_CXX_EXCEPTIONS}")
 
 # find dependencies
 ## pthread
 find_package(Threads REQUIRED)
 
+if(NOT ABSL_CCTZ_TARGET)
+  set(ABSL_CCTZ_TARGET cctz)
+endif()
+
 # commented: used only for standalone test
 #add_subdirectory(cctz)
 #add_subdirectory(googletest)
+check_target(${ABSL_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)
+
+  list(APPEND ABSL_TEST_COMMON_LIBRARIES
+    gtest_main
+    gtest
+    gmock
+    ${CMAKE_THREAD_LIBS_INIT}
+  )
+endif()
 
 add_subdirectory(absl)