666fc1266b
-- bc89d3221e3927d08881d75eeee0e8db862300fa by Benjamin Barenblat <bbaren@google.com>: Clean up C-style casts in `ABSL_ASSERT` PiperOrigin-RevId: 241932756 -- 17482daae4b3e2fc725b759586590ac466b72a1e by Jon Cohen <cohenjon@google.com>: Move Gtest-specific CMake code to its own directory PiperOrigin-RevId: 241920192 -- 9ae52b4f665625352c0a789cff884bde492c28f5 by CJ Johnson <johnsoncj@google.com>: Moves private data methods from InlinedVector to InlinedVector Storage in anticipation of migrating the Rep union type PiperOrigin-RevId: 241794144 -- 95315bc50a61a0aae4f171b44c2312158a43e72e by Jon Cohen <cohenjon@google.com>: Use /DNOMINMAX in Abseil tests. This offsets inlcudes of <windows.h> from gtest. PiperOrigin-RevId: 241790584 -- ee505c7f2ab99d29c165ea21a07190474f64053d by CJ Johnson <johnsoncj@google.com>: Adds inlined_vector_internal to the deps of inlined_vector in CMakeLists.txt PiperOrigin-RevId: 241775332 -- 94eb5165b49bab59ce7de143be38a4581d5658da by CJ Johnson <johnsoncj@google.com>: Migrates InlinedVector Storage to class Metadata for compatibility with the eventual member-wise migration to the new exception safe implementation PiperOrigin-RevId: 241633420 -- f99e172caad1ec8b35bf7bbabaf2833d55a6f055 by Abseil Team <absl-team@google.com>: Add MSVC specific linker flags only to MSVC builds. PiperOrigin-RevId: 241615711 -- 3ad19d2779281e945bdf56643dc5cee3f730eb4f by Abseil Team <absl-team@google.com>: Add a comment about per-process randomization of absl::Hash. PiperOrigin-RevId: 241583697 -- 8dfb02d725fee3528351b2da4ed32a7455f9858a by Tom Manshreck <shreck@google.com>: Internal change PiperOrigin-RevId: 241564734 GitOrigin-RevId: bc89d3221e3927d08881d75eeee0e8db862300fa Change-Id: Ibad3da416d08a96ec1f8313f8b519b4270b7e01a
55 lines
2.1 KiB
CMake
55 lines
2.1 KiB
CMake
# See absl/copts/copts.py and absl/copts/generate_copts.py
|
|
include(GENERATED_AbseilCopts)
|
|
|
|
set(ABSL_LSAN_LINKOPTS "")
|
|
set(ABSL_HAVE_LSAN OFF)
|
|
set(ABSL_DEFAULT_LINKOPTS "")
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
set(ABSL_DEFAULT_COPTS "${ABSL_GCC_FLAGS}")
|
|
set(ABSL_TEST_COPTS "${ABSL_GCC_FLAGS};${ABSL_GCC_TEST_FLAGS}")
|
|
set(ABSL_EXCEPTIONS_FLAG "${ABSL_GCC_EXCEPTIONS_FLAGS}")
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
|
# MATCHES so we get both Clang and AppleClang
|
|
if(MSVC)
|
|
# clang-cl is half MSVC, half LLVM
|
|
set(ABSL_DEFAULT_COPTS "${ABSL_CLANG_CL_FLAGS}")
|
|
set(ABSL_TEST_COPTS "${ABSL_CLANG_CL_FLAGS};${ABSL_CLANG_CL_TEST_FLAGS}")
|
|
set(ABSL_EXCEPTIONS_FLAG "${ABSL_CLANG_CL_EXCEPTIONS_FLAGS}")
|
|
set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
|
|
else()
|
|
set(ABSL_DEFAULT_COPTS "${ABSL_LLVM_FLAGS}")
|
|
set(ABSL_TEST_COPTS "${ABSL_LLVM_FLAGS};${ABSL_LLVM_TEST_FLAGS}")
|
|
set(ABSL_EXCEPTIONS_FLAG "${ABSL_LLVM_EXCEPTIONS_FLAGS}")
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
|
# AppleClang doesn't have lsan
|
|
# https://developer.apple.com/documentation/code_diagnostics
|
|
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5)
|
|
set(ABSL_LSAN_LINKOPTS "-fsanitize=leak")
|
|
set(ABSL_HAVE_LSAN ON)
|
|
endif()
|
|
endif()
|
|
endif()
|
|
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
set(ABSL_DEFAULT_COPTS "${ABSL_MSVC_FLAGS}")
|
|
set(ABSL_TEST_COPTS "${ABSL_MSVC_FLAGS};${ABSL_MSVC_TEST_FLAGS}")
|
|
set(ABSL_EXCEPTIONS_FLAG "${ABSL_MSVC_EXCEPTIONS_FLAGS}")
|
|
set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
|
|
else()
|
|
message(WARNING "Unknown compiler: ${CMAKE_CXX_COMPILER}. Building with no default flags")
|
|
set(ABSL_DEFAULT_COPTS "")
|
|
set(ABSL_TEST_COPTS "")
|
|
set(ABSL_EXCEPTIONS_FLAG "")
|
|
endif()
|
|
|
|
# This flag is used internally for Bazel builds and is kept here for consistency
|
|
set(ABSL_EXCEPTIONS_FLAG_LINKOPTS "")
|
|
|
|
if("${CMAKE_CXX_STANDARD}" EQUAL 98)
|
|
message(FATAL_ERROR "Abseil requires at least C++11")
|
|
elseif(NOT "${CMAKE_CXX_STANDARD}")
|
|
message(STATUS "No CMAKE_CXX_STANDARD set, assuming 11")
|
|
set(ABSL_CXX_STANDARD 11)
|
|
else()
|
|
set(ABSL_CXX_STANDARD "${CMAKE_CXX_STANDARD}")
|
|
endif()
|