Skip to content

Commit 35aa92d

Browse files
update supported cmake versions and add some tests with newer compilers (#972)
Update and test with some newer compilers and cmake versions --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9dfeefe commit 35aa92d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+416
-356
lines changed

.ci/azure-cmake-new.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
steps:
2+
# Note that silkeh/clang does not include ca-certificates, so check the shasum for verification
3+
- bash: |
4+
wget --no-check-certificate "https://cmake.org/files/v3.28/cmake-3.28.0-linux-x86_64.tar.gz"
5+
echo "898f0b5ca6e2ea5286998e97bd33f030d7d09f18ca4b88be661fdfbad5dadd88 cmake-3.28.0-linux-x86_64.tar.gz" | shasum -sca 256
6+
displayName: Download CMake
7+
8+
- task: ExtractFiles@1
9+
inputs:
10+
archiveFilePatterns: "cmake*.tar.gz"
11+
destinationFolder: "cmake_program"
12+
displayName: Extract CMake
13+
14+
- bash:
15+
echo
16+
"##vso[task.prependpath]$(Build.SourcesDirectory)/cmake_program/cmake-3.28.0-linux-x86_64/bin"
17+
displayName: Add CMake to PATH

.clang-tidy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# modernize-avoid-c-arrays trips up in TEMPLATE_TEST_CASE catch macro
77
# modernize-return-braced-init-list triggers on lambdas ?
88
# modernize-make-unique requires C++14
9+
# modernize-type_traits requires C++17
910
# readability-avoid-const-params-in-decls Affected by the pre-compile split
1011

1112
Checks: |
@@ -37,6 +38,8 @@ Checks: |
3738
-modernize-concat-nested-namespaces,
3839
-modernize-return-braced-init-list,
3940
-modernize-make-unique,
41+
-modernize-type-traits,
42+
-modernize-macro-to-enum,
4043
*performance*,
4144
-performance-unnecessary-value-param,
4245
-performance-inefficient-string-concatenation,

.github/workflows/tests.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
clang-tidy:
6161
name: Clang-Tidy
6262
runs-on: ubuntu-latest
63-
container: silkeh/clang:14
63+
container: silkeh/clang:17
6464
steps:
6565
- uses: actions/checkout@v4
6666

@@ -91,7 +91,7 @@ jobs:
9191
cuda12-build:
9292
name: CUDA 12 build only
9393
runs-on: ubuntu-latest
94-
container: nvidia/cuda:12.1.0-devel-ubuntu22.04
94+
container: nvidia/cuda:12.3.1-devel-ubuntu22.04
9595
steps:
9696
- name: Add build tools
9797
run: apt-get update && apt-get install -y wget git cmake
@@ -336,9 +336,15 @@ jobs:
336336
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
337337
if: success() || failure()
338338

339-
- name: Check CMake 3.27 (full)
339+
- name: Check CMake 3.27
340340
uses: ./.github/actions/quick_cmake
341341
with:
342342
cmake-version: "3.27"
343+
if: success() || failure()
344+
345+
- name: Check CMake 3.28 (full)
346+
uses: ./.github/actions/quick_cmake
347+
with:
348+
cmake-version: "3.28"
343349
args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
344350
if: success() || failure()

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 3.5)
22
# Note: this is a header only library. If you have an older CMake than 3.5,
33
# just add the CLI11/include directory and that's all you need to do.
44

5-
# Make sure users don't get warnings on a tested (3.5 to 3.26) version
5+
# Make sure users don't get warnings on a tested (3.5 to 3.28) version
66
# of CMake. For most of the policies, the new version is better (hence the change).
7-
# We don't use the 3.5...3.26 syntax because of a bug in an older MSVC's
7+
# We don't use the 3.5...3.28 syntax because of a bug in an older MSVC's
88
# built-in and modified CMake 3.11
9-
if(${CMAKE_VERSION} VERSION_LESS 3.26)
9+
if(${CMAKE_VERSION} VERSION_LESS 3.28)
1010
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
1111
else()
12-
cmake_policy(VERSION 3.26)
12+
cmake_policy(VERSION 3.28)
1313
endif()
1414

1515
set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")

azure-pipelines.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,28 @@ jobs:
150150
- template: .ci/azure-cmake.yml
151151
- template: .ci/azure-build.yml
152152
- template: .ci/azure-test.yml
153+
154+
- job: Docker_new
155+
variables:
156+
cli11.single: OFF
157+
pool:
158+
vmImage: "ubuntu-latest"
159+
strategy:
160+
matrix:
161+
gcc13:
162+
containerImage: gcc:13
163+
cli11.std: 17
164+
cli11.options: -DCMAKE_CXX_FLAGS="-Wstrict-overflow=5"
165+
gcc12:
166+
containerImage: gcc:12
167+
cli11.std: 20
168+
cli11.options: -DCMAKE_CXX_FLAGS="-Wredundant-decls -Wconversion"
169+
clang17_20:
170+
containerImage: silkeh/clang:17
171+
cli11.std: 23
172+
cli11.options: -DCMAKE_CXX_FLAGS=-std=c++23
173+
container: $[ variables['containerImage'] ]
174+
steps:
175+
- template: .ci/azure-cmake-new.yml
176+
- template: .ci/azure-build.yml
177+
- template: .ci/azure-test.yml

book/chapters/options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ CLI::Option* opt = app.add_flag("--opt");
283283
CLI11_PARSE(app, argv, argc);
284284

285285
if(* opt)
286-
std::cout << "Flag received " << opt->count() << " times." << std::endl;
286+
std::cout << "Flag received " << opt->count() << " times." << '\n';
287287
```
288288
289289
## Inheritance of defaults

examples/arg_capture.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ int main(int argc, const char *argv[]) {
2525
subcom->alias("--sub");
2626
CLI11_PARSE(app, argc, argv);
2727

28-
std::cout << "value=" << value << std::endl;
28+
std::cout << "value=" << value << '\n';
2929
std::cout << "after Args:";
3030
for(const auto &aarg : subcom->remaining()) {
3131
std::cout << aarg << " ";
3232
}
33-
std::cout << std::endl;
33+
std::cout << '\n';
3434
}

examples/config_app.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ int main(int argc, char **argv) {
4040
}
4141

4242
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
43-
<< ", opt count: " << opt->count() << std::endl;
43+
<< ", opt count: " << opt->count() << '\n';
4444
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
45-
<< ", opt count: " << copt->count() << std::endl;
45+
<< ", opt count: " << copt->count() << '\n';
4646
std::cout << "Received flag: " << v << " (" << flag->count() << ") times\n";
47-
std::cout << "Some value: " << value << std::endl;
47+
std::cout << "Some value: " << value << '\n';
4848

4949
return 0;
5050
}

examples/custom_parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using DoubleValues = Values<double>;
2323

2424
// the lexical cast operator should be in the same namespace as the type for ADL to work properly
2525
bool lexical_cast(const std::string &input, Values<double> & /*v*/) {
26-
std::cout << "called correct lexical_cast function ! val: " << input << std::endl;
26+
std::cout << "called correct lexical_cast function ! val: " << input << '\n';
2727
return true;
2828
}
2929

examples/digit_args.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ int main(int argc, char **argv) {
1616

1717
CLI11_PARSE(app, argc, argv);
1818

19-
std::cout << "value = " << val << std::endl;
19+
std::cout << "value = " << val << '\n';
2020
return 0;
2121
}

0 commit comments

Comments
 (0)