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
113project (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 >)
6355endif ()
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
7560set (msvc -rt $<TARGET_PROPERTY :MSVC_RUNTIME_LIBRARY >)
7661
@@ -80,8 +65,6 @@ set(msvc-rt-mt-static $<STREQUAL:${msvc-rt},MultiThreaded>)
8065set (msvc -rt-mtd-dll $<STREQUAL :${msvc -rt },MultiThreadedDebugDLL >)
8166set (msvc -rt-mt-dll $<STREQUAL :${msvc -rt },MultiThreadedDLL >)
8267
83- set (backport-msvc -runtime $<VERSION_LESS :${CMAKE_VERSION} ,3.15>)
84-
8568add_library (yaml-cpp ${yaml-cpp-type} "" )
8669add_library (yaml-cpp::yaml-cpp ALIAS yaml-cpp )
8770
@@ -118,11 +101,6 @@ endif()
118101
119102target_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
0 commit comments