Merge pull request #69 from romange/master

Relax dependency requirements for google test library and allow customization of cctz target
pull/86/merge
Jonathan Cohen 7 years ago committed by GitHub
commit e5c6ee2d00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      CMake/README.md
  2. 33
      CMakeLists.txt
  3. 2
      absl/time/CMakeLists.txt

@ -28,8 +28,11 @@
Note: Abseil requires CCTZ and the googletest framework. Consequently,
the targets `gtest`, `gtest_main`, `gmock` and `cctz` need
to be declared in your project before including abseil with `add_subdirectory`.
to be declared in your project before including abseil with
`add_subdirectory`. However, if abseil is compiled with
`-DBUILD_TESTING=OFF`, then `gtest`, `gmock` and `gtest_main` are not
required. In addition, it's possible to override the name of the `cctz`
target to a custom one with option `-DABSL_CCTZ_TARGET=*my_cctz*`.
4- Add the absl:: target you wish to use to the `target_link_libraries()`
section of your executable or of your library

@ -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)

@ -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 ${ABSL_CCTZ_TARGET})
absl_library(
TARGET

Loading…
Cancel
Save