Skip to content

Commit 8beb80a

Browse files
committed
[cmake] Require CMake 3.15 or newer
1 parent 2f86d13 commit 8beb80a

File tree

2 files changed

+5
-32
lines changed

2 files changed

+5
-32
lines changed

CMakeLists.txt

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# 3.5 is actually available almost everywhere.
22
# 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()
3+
cmake_minimum_required(VERSION 3.15...4.0)
104

115
project(YAML_CPP VERSION 0.8.0 LANGUAGES CXX)
126

@@ -61,15 +55,8 @@ if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
6155
MultiThreaded$<$<CONFIG:Debug>:Debug>$<${msvc-shared_rt}:DLL>)
6256
endif()
6357

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

7461
set(msvc-rt $<TARGET_PROPERTY:MSVC_RUNTIME_LIBRARY>)
7562

@@ -79,8 +66,6 @@ set(msvc-rt-mt-static $<STREQUAL:${msvc-rt},MultiThreaded>)
7966
set(msvc-rt-mtd-dll $<STREQUAL:${msvc-rt},MultiThreadedDebugDLL>)
8067
set(msvc-rt-mt-dll $<STREQUAL:${msvc-rt},MultiThreadedDLL>)
8168

82-
set(backport-msvc-runtime $<VERSION_LESS:${CMAKE_VERSION},3.15>)
83-
8469
add_library(yaml-cpp ${yaml-cpp-type} "")
8570
add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp)
8671

@@ -117,11 +102,6 @@ endif()
117102

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

test/CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,8 @@ else()
1616
include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/googletest-1.13.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

0 commit comments

Comments
 (0)