summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Copybara-Service <copybara-worker@google.com>2022-08-12 07:25:40 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-08-12 07:25:40 -0700
commit252bb88f1ba68be656912d073b452b019737e8e8 (patch)
tree34bb452f4d0088dda9bee17a4ad94d5f61adbb78
parent697acabc5b7e28c51f7ab8d2f43d4ef4fed77f8d (diff)
parent436f267ca30dd0c8e251f3380fcd1ff98117a3e7 (diff)
Merge pull request #1249 from evanacox:master
PiperOrigin-RevId: 467204807 Change-Id: Id7949726d67a16bf2daead7503f84e8b862fdb5f
-rw-r--r--CMake/AbseilHelpers.cmake10
-rw-r--r--CMakeLists.txt4
2 files changed, 12 insertions, 2 deletions
diff --git a/CMake/AbseilHelpers.cmake b/CMake/AbseilHelpers.cmake
index f81d57cf..96d815dd 100644
--- a/CMake/AbseilHelpers.cmake
+++ b/CMake/AbseilHelpers.cmake
@@ -26,6 +26,12 @@ if(NOT DEFINED ABSL_IDE_FOLDER)
set(ABSL_IDE_FOLDER Abseil)
endif()
+if(ABSL_USE_SYSTEM_INCLUDES)
+ set(ABSL_INTERNAL_INCLUDE_WARNING_GUARD SYSTEM)
+else()
+ set(ABSL_INTERNAL_INCLUDE_WARNING_GUARD "")
+endif()
+
# absl_cc_library()
#
# CMake function to imitate Bazel's cc_library rule.
@@ -242,7 +248,7 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
# unconditionally.
set_property(TARGET ${_NAME} PROPERTY LINKER_LANGUAGE "CXX")
- target_include_directories(${_NAME}
+ target_include_directories(${_NAME} ${ABSL_INTERNAL_INCLUDE_WARNING_GUARD}
PUBLIC
"$<BUILD_INTERFACE:${ABSL_COMMON_INCLUDE_DIRS}>"
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
@@ -290,7 +296,7 @@ Cflags: -I\${includedir}${PC_CFLAGS}\n")
else()
# Generating header-only library
add_library(${_NAME} INTERFACE)
- target_include_directories(${_NAME}
+ target_include_directories(${_NAME} ${ABSL_INTERNAL_INCLUDE_WARNING_GUARD}
INTERFACE
"$<BUILD_INTERFACE:${ABSL_COMMON_INCLUDE_DIRS}>"
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10acf3b7..995d90e5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,6 +70,10 @@ if((${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.8) AND (NOT ABSL_PROPAGATE_CXX_STD)
message(WARNING "A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake 3.8 and up. We recommend enabling this option to ensure your project still builds correctly.")
endif()
+option(ABSL_USE_SYSTEM_INCLUDES
+ "Silence warnings in Abseil headers by marking them as SYSTEM includes"
+ OFF)
+
list(APPEND CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/CMake
${CMAKE_CURRENT_LIST_DIR}/absl/copts