diff options
Diffstat (limited to 'infra/cmake/packages/AbseilConfig.cmake')
-rw-r--r-- | infra/cmake/packages/AbseilConfig.cmake | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/infra/cmake/packages/AbseilConfig.cmake b/infra/cmake/packages/AbseilConfig.cmake index 6fae7211d..b3cb364e1 100644 --- a/infra/cmake/packages/AbseilConfig.cmake +++ b/infra/cmake/packages/AbseilConfig.cmake @@ -12,11 +12,18 @@ function(_Abseil_import) # NOTE Turn off abseil testing set(BUILD_TESTING OFF) + # Set -fPIC property because Abseil-cpp can be used for shared library + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # Abseil-cpp 20211102.0 show warning without below setting + set(ABSL_PROPAGATE_CXX_STD ON) + add_extdirectory("${AbseilSource_DIR}" ABSEIL) add_library(abseil INTERFACE) + target_link_libraries(abseil INTERFACE # From "Available Abseil CMake Public Targets" in CMake/README.md + # Add absl::status (It is not listed in CMake/README.md) absl::algorithm absl::base absl::debugging @@ -27,19 +34,14 @@ function(_Abseil_import) absl::numeric absl::random_random absl::strings - absl::status absl::synchronization absl::time absl::utility + absl::status ) endif(NOT TARGET abseil) set(Abseil_FOUND TRUE PARENT_SCOPE) endfunction(_Abseil_import) -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC") -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fPIC") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC") - _Abseil_import() |