You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Use CMake C++ standard meta features (e.g. cxx_std_11) that propagate to targets that link to Abseil"
72
+
OFF) # TODO: Default to ON for CMake 3.8 and greater.
73
+
if((${CMAKE_VERSION}VERSION_GREATER_EQUAL3.8) AND (NOTABSL_PROPAGATE_CXX_STD))
74
+
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.")
47
75
endif()
48
76
49
77
list(APPENDCMAKE_MODULE_PATH
50
78
${CMAKE_CURRENT_LIST_DIR}/CMake
51
79
${CMAKE_CURRENT_LIST_DIR}/absl/copts
52
80
)
53
81
54
-
include(AbseilInstallDirs)
55
82
include(CMakePackageConfigHelpers)
83
+
include(GNUInstallDirs)
56
84
include(AbseilDll)
57
85
include(AbseilHelpers)
58
86
@@ -81,75 +109,87 @@ endif()
81
109
## pthread
82
110
find_package(ThreadsREQUIRED)
83
111
112
+
include(CMakeDependentOption)
113
+
84
114
option(ABSL_USE_EXTERNAL_GOOGLETEST
85
115
"If ON, Abseil will assume that the targets for GoogleTest are already provided by the including project. This makes sense when Abseil is used with add_subproject."OFF)
86
116
117
+
cmake_dependent_option(ABSL_FIND_GOOGLETEST
118
+
"If ON, Abseil will use find_package(GTest) rather than assuming that GoogleTest is already provided by the including project."
119
+
ON
120
+
"ABSL_USE_EXTERNAL_GOOGLETEST"
121
+
OFF)
122
+
87
123
88
124
option(ABSL_USE_GOOGLETEST_HEAD
89
-
"If ON, abseil will download HEAD from googletest at config time."OFF)
125
+
"If ON, abseil will download HEAD from GoogleTest at config time."OFF)
126
+
127
+
set(ABSL_GOOGLETEST_DOWNLOAD_URL""CACHESTRING"If set, download GoogleTest from this URL")
"If ABSL_USE_GOOGLETEST_HEAD is OFF, specifies the directory of a local googletest checkout."
130
+
"If ABSL_USE_GOOGLETEST_HEAD is OFF and ABSL_GOOGLETEST_URL is not set, specifies the directory of a local GoogleTest checkout."
93
131
)
94
132
95
-
option(ABSL_RUN_TESTS"If ON, Abseil tests will be run."OFF)
96
-
97
-
if(${ABSL_RUN_TESTS})
98
-
# enable CTest. This will set BUILD_TESTING to ON unless otherwise specified
99
-
# on the command line
100
-
include(CTest)
101
-
133
+
if(BUILD_TESTING)
102
134
## check targets
103
-
if (NOTABSL_USE_EXTERNAL_GOOGLETEST)
135
+
if (ABSL_USE_EXTERNAL_GOOGLETEST)
136
+
if (ABSL_FIND_GOOGLETEST)
137
+
find_package(GTestREQUIRED)
138
+
else()
139
+
if (NOTTARGETgtestANDNOTTARGETGTest::gtest)
140
+
message(FATAL_ERROR"ABSL_USE_EXTERNAL_GOOGLETEST is ON and ABSL_FIND_GOOGLETEST is OFF, which means that the top-level project must build the Google Test project. However, the target gtest was not found.")
0 commit comments