Skip to content

Commit c237bb9

Browse files
authored
[cmake] Require CMake 3.15 or newer (#1358)
* [cmake] Require CMake 3.15 or newer * [test] Update Google-test to 1.16 * [ci] Add workflow to configure with CMake 3.15 Ensure that oldest supportest version of CMake can configure project Copy quick_cmake from CLIUtils/CLI11 log: requires cmake 3.15 as a minimum
1 parent 55a0a28 commit c237bb9

257 files changed

Lines changed: 6764 additions & 5033 deletions

File tree

Some content is hidden

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

.bazelignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
test/googletest-1.13.0
1+
test/googletest-1.16.0

.codedocs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ EXAMPLE_PATH =
88

99
# One or more directories and files to exclude from documentation generation.
1010
# Use relative paths with respect to the repository root directory.
11-
EXCLUDE = test/googletest-1.13.0/
11+
EXCLUDE = test/googletest-1.16.0/
1212

1313
# One or more wildcard patterns to exclude files and directories from document
1414
# generation.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Quick CMake config
2+
description: "Runs CMake 3.14+ (if already setup)"
3+
inputs:
4+
args:
5+
description: "Other arguments"
6+
required: false
7+
default: ""
8+
cmake-version:
9+
description: "The CMake version to run"
10+
required: true
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: CMake ${{ inputs.cmake-version }}
16+
uses: jwlawson/actions-setup-cmake@v2.2
17+
with:
18+
cmake-version: "${{ inputs.cmake-version }}"
19+
- run: |
20+
mkdir -p build-tmp
21+
touch build-tmp/tmp
22+
rm -r build-tmp/*
23+
(cd build-tmp && cmake .. ${{ inputs.args }})
24+
rm -r build-tmp
25+
shell: bash

.github/workflows/build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,24 @@ jobs:
104104
--config ${{ env.CMAKE_BUILD_TYPE }} \
105105
--verbose
106106
107+
cmake-config-oldest-cmake:
108+
name: CMake version range config check (Ubuntu 24.04)
109+
runs-on: ubuntu-24.04
110+
steps:
111+
- uses: actions/checkout@v6
112+
113+
- name: Check CMake 3.15
114+
uses: ./.github/actions/quick_cmake
115+
with:
116+
cmake-version: "3.15"
117+
if: success() || failure()
118+
119+
- name: Check CMake 4.3
120+
uses: ./.github/actions/quick_cmake
121+
with:
122+
cmake-version: "4.3"
123+
if: success() || failure()
124+
107125
bazel-build:
108126
strategy:
109127
matrix:

CMakeLists.txt

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# 3.5 is actually available almost everywhere.
2-
# 3.30 as the upper policy limit avoids CMake deprecation warnings.
3-
cmake_minimum_required(VERSION 3.5...3.30)
4-
5-
# enable MSVC_RUNTIME_LIBRARY target property
6-
# see https://cmake.org/cmake/help/latest/policy/CMP0091.html
7-
if(POLICY CMP0091)
8-
cmake_policy(SET CMP0091 NEW)
9-
endif()
1+
cmake_minimum_required(VERSION 3.15..4.3)
102

113
project(YAML_CPP VERSION 0.9.0 LANGUAGES CXX)
124

@@ -62,15 +54,8 @@ if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
6254
MultiThreaded$<$<CONFIG:Debug>:Debug>$<${msvc-shared_rt}:DLL>)
6355
endif()
6456

65-
set(contrib-pattern "src/contrib/*.cpp")
66-
set(src-pattern "src/*.cpp")
67-
if (CMAKE_VERSION VERSION_GREATER 3.12)
68-
list(INSERT contrib-pattern 0 CONFIGURE_DEPENDS)
69-
list(INSERT src-pattern 0 CONFIGURE_DEPENDS)
70-
endif()
71-
72-
file(GLOB yaml-cpp-contrib-sources ${contrib-pattern})
73-
file(GLOB yaml-cpp-sources ${src-pattern})
57+
file(GLOB yaml-cpp-contrib-sources CONFIGURE_DEPENDS "src/contrib/*.cpp")
58+
file(GLOB yaml-cpp-sources CONFIGURE_DEPENDS "src/*.cpp")
7459

7560
set(msvc-rt $<TARGET_PROPERTY:MSVC_RUNTIME_LIBRARY>)
7661

@@ -80,8 +65,6 @@ set(msvc-rt-mt-static $<STREQUAL:${msvc-rt},MultiThreaded>)
8065
set(msvc-rt-mtd-dll $<STREQUAL:${msvc-rt},MultiThreadedDebugDLL>)
8166
set(msvc-rt-mt-dll $<STREQUAL:${msvc-rt},MultiThreadedDLL>)
8267

83-
set(backport-msvc-runtime $<VERSION_LESS:${CMAKE_VERSION},3.15>)
84-
8568
add_library(yaml-cpp ${yaml-cpp-type} "")
8669
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
8770

@@ -118,11 +101,6 @@ endif()
118101

119102
target_compile_options(yaml-cpp
120103
PRIVATE
121-
$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-static}>:-MTd>
122-
$<$<AND:${backport-msvc-runtime},${msvc-rt-mt-static}>:-MT>
123-
$<$<AND:${backport-msvc-runtime},${msvc-rt-mtd-dll}>:-MDd>
124-
$<$<AND:${backport-msvc-runtime},${msvc-rt-mt-dll}>:-MD>
125-
126104
# /wd4127 = disable warning C4127 "conditional expression is constant"
127105
# http://msdn.microsoft.com/en-us/library/6t66728h.aspx
128106
# /wd4355 = disable warning C4355 "'this' : used in base member initializer list

test/CMakeLists.txt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,13 @@ if(YAML_USE_SYSTEM_GTEST)
1111
endif()
1212
else()
1313
add_subdirectory(
14-
"${CMAKE_CURRENT_SOURCE_DIR}/googletest-1.13.0"
14+
"${CMAKE_CURRENT_SOURCE_DIR}/googletest-1.16.0"
1515
"${CMAKE_CURRENT_BINARY_DIR}/prefix")
16-
include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/googletest-1.13.0/googletest/include")
16+
include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/googletest-1.16.0/googletest/include")
1717
endif()
1818

19-
set(test-new-api-pattern "new-api/*.cpp")
20-
set(test-source-pattern "*.cpp" "integration/*.cpp" "node/*.cpp")
21-
if (CMAKE_VERSION VERSION_GREATER 3.11)
22-
list(INSERT test-new-api-pattern 0 CONFIGURE_DEPENDS)
23-
list(INSERT test-source-pattern 0 CONFIGURE_DEPENDS)
24-
endif()
25-
26-
file(GLOB test-new-api-sources ${test-new-api-pattern})
27-
file(GLOB test-sources ${test-source-pattern})
19+
file(GLOB test-new-api-sources CONFIGURE_DEPENDS "new-api/*.cpp")
20+
file(GLOB test-sources CONFIGURE_DEPENDS "*.cpp" "integration/*.cpp" "node/*.cpp")
2821

2922
add_executable(yaml-cpp-tests "")
3023
target_sources(yaml-cpp-tests

test/googletest-1.13.0/.github/ISSUE_TEMPLATE/00-bug_report.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

test/googletest-1.13.0/.github/ISSUE_TEMPLATE/10-feature_request.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

test/googletest-1.13.0/.github/ISSUE_TEMPLATE/config.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/googletest-1.13.0/.github/workflows/gtest-ci.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)