Skip to content

Commit 3f368eb

Browse files
committed
Increment minimum required CMake version to 3.15 (nonstd-lite issue 73)
nonstd-lite/nonstd-lite#73
1 parent d75f389 commit 3f368eb

File tree

3 files changed

+23
-7
lines changed

3 files changed

+23
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Distributed under the Boost Software License, Version 1.0.
66
# (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
77

8-
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
8+
cmake_minimum_required( VERSION 3.15 FATAL_ERROR )
99

1010
# value_ptr-lite project and version, updated by script/update-version.py:
1111

example/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
77

88
if( NOT DEFINED CMAKE_MINIMUM_REQUIRED_VERSION )
9-
cmake_minimum_required( VERSION 3.8 FATAL_ERROR )
9+
cmake_minimum_required( VERSION 3.15 FATAL_ERROR )
1010
endif()
1111

1212
project( example LANGUAGES CXX )

test/CMakeLists.txt

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77

88

99
if( NOT DEFINED CMAKE_MINIMUM_REQUIRED_VERSION )
10-
cmake_minimum_required( VERSION 3.5 FATAL_ERROR )
10+
cmake_minimum_required( VERSION 3.15 FATAL_ERROR )
1111
endif()
1212

1313
project( test LANGUAGES CXX )
1414

1515
option( VALUE_PTR_LITE_COLOURISE_TEST "Colourise test output" OFF )
1616

17-
set( unit_name "value-ptr" )
17+
# unit_name provided by toplevel CMakeLists.txt [set( unit_name "xxx" )]
1818
set( PACKAGE ${unit_name}-lite )
1919
set( PROGRAM ${unit_name}-lite )
2020
set( SOURCES ${unit_name}-main.t.cpp ${unit_name}.t.cpp )
21+
set( TWEAKD "." )
2122

2223
message( STATUS "Subproject '${PROJECT_NAME}', programs '${PROGRAM}-*'")
2324

@@ -76,6 +77,9 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
7677
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1.0 )
7778
set( HAS_CPP17_FLAG TRUE )
7879
endif()
80+
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0.0 )
81+
set( HAS_CPP20_FLAG TRUE )
82+
endif()
7983

8084
# AppleClang: available -std flags depends on version
8185
elseif( CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" )
@@ -90,6 +94,9 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
9094
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.2.0 )
9195
set( HAS_CPP17_FLAG TRUE )
9296
endif()
97+
# if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS x.x.x )
98+
# set( HAS_CPP20_FLAG TRUE )
99+
# endif()
93100

94101
# Clang: available -std flags depends on version
95102
elseif( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
@@ -104,6 +111,9 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
104111
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0.0 )
105112
set( HAS_CPP17_FLAG TRUE )
106113
endif()
114+
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0.0 )
115+
set( HAS_CPP20_FLAG TRUE )
116+
endif()
107117
endif()
108118

109119
elseif( CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
@@ -132,6 +142,7 @@ function( make_target target std )
132142

133143
add_executable ( ${target} ${SOURCES} )
134144
target_include_directories( ${target} SYSTEM PRIVATE lest )
145+
target_include_directories( ${target} PRIVATE ${TWEAKD} )
135146
target_link_libraries ( ${target} PRIVATE ${PACKAGE} )
136147
target_compile_options ( ${target} PRIVATE ${OPTIONS} )
137148
target_compile_definitions( ${target} PRIVATE ${DEFINITIONS} )
@@ -179,17 +190,19 @@ else()
179190
enable_msvs_guideline_checker( ${PROGRAM}-cpp17.t )
180191
endif()
181192

193+
if( HAS_CPP20_FLAG )
194+
make_target( ${PROGRAM}-cpp20.t 20 )
195+
endif()
196+
182197
if( HAS_CPPLATEST_FLAG )
183198
make_target( ${PROGRAM}-cpplatest.t latest )
184199
endif()
185200
endif()
186201

187202
# configure unit tests via CTest:
188203

189-
enable_testing()
190-
191204
if( HAS_STD_FLAGS )
192-
# unconditionally add C++98 variant for MSVC:
205+
# unconditionally add C++98 variant for MSVC:
193206
add_test( NAME test-cpp98 COMMAND ${PROGRAM}-cpp98.t )
194207

195208
if( HAS_CPP11_FLAG )
@@ -201,6 +214,9 @@ if( HAS_STD_FLAGS )
201214
if( HAS_CPP17_FLAG )
202215
add_test( NAME test-cpp17 COMMAND ${PROGRAM}-cpp17.t )
203216
endif()
217+
if( HAS_CPP20_FLAG )
218+
add_test( NAME test-cpp20 COMMAND ${PROGRAM}-cpp20.t )
219+
endif()
204220
if( HAS_CPPLATEST_FLAG )
205221
add_test( NAME test-cpplatest COMMAND ${PROGRAM}-cpplatest.t )
206222
endif()

0 commit comments

Comments
 (0)