Skip to content

Commit f62d7b7

Browse files
authored
[cmake] Require CMake 3.16 (#292)
Follow Google's OSS policy. Remove other code specific for CMake < 3.16
1 parent 5b5c77d commit f62d7b7

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

CMakeLists.txt

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
cmake_minimum_required(VERSION 2.8.12)
2-
3-
if (POLICY CMP0025)
4-
cmake_policy(SET CMP0025 NEW)
5-
endif()
1+
# https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md
2+
# As of 2024-07-01, CMake 3.16 is the minimum supported version.
3+
cmake_minimum_required(VERSION 3.16)
64

75
project(cctz)
86

@@ -51,20 +49,12 @@ if (BUILD_TESTING)
5149
)
5250
endif()
5351

54-
# Starting from CMake >= 3.1, if a specific standard is required,
52+
# If a specific standard is required,
5553
# it can be set from the command line with:
56-
# cmake -DCMAKE_CXX_STANDARD=[11|14|17]
54+
# cmake -DCMAKE_CXX_STANDARD=[11|14|17|20|23]
5755
function(cctz_target_set_cxx_standard target)
5856
set(cxx_standard 11)
59-
if (CMAKE_VERSION VERSION_LESS "3.1")
60-
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
61-
target_compile_options(${target} PRIVATE -std=c++${cxx_standard})
62-
endif()
63-
elseif (CMAKE_VERSION VERSION_LESS "3.8")
64-
set_property(TARGET ${target} PROPERTY CXX_STANDARD ${cxx_standard})
65-
else()
66-
target_compile_features(${target} PUBLIC cxx_std_${cxx_standard})
67-
endif()
57+
target_compile_features(${target} PUBLIC cxx_std_${cxx_standard})
6858
endfunction()
6959

7060
if(APPLE)
@@ -191,10 +181,6 @@ install(FILES cmake/${PROJECT_NAME}-config.cmake
191181
DESTINATION ${CMAKE_INSTALL_CONFIGDIR}
192182
)
193183

194-
if (CMAKE_VERSION VERSION_LESS "3.8")
195-
set(quiet_on_empty "")
196-
else()
197-
set(quiet_on_empty QUIET_ON_EMPTY)
198-
endif()
184+
set(quiet_on_empty QUIET_ON_EMPTY)
199185

200186
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES ${quiet_on_empty})

0 commit comments

Comments
 (0)