mirror of
https://github.com/nlohmann/json.git
synced 2024-07-15 19:05:46 +02:00
fac07e22c5
Starting with CMake 3.27, deprecation warnings are issued when asking for policy settings for CMake 3.4 or earlier. The cmake_minimum_required() command accepts a version range, which allows NEW policy settings up to the upper end of that range to be used, but without raising the minimum CMake version above the bottom of that range. This means NEW policy settings will be used where available, without requiring them. This change updates the project's cmake_minimum_required() calls to use a version range to extend the upper policy version to 3.14 where it wasn't already at that version or higher. This prevents the deprecation warning from CMake 3.27, and gives breathing space before a future CMake release will start issuing similar deprecation warnings again.
22 lines
992 B
CMake
22 lines
992 B
CMake
cmake_minimum_required(VERSION 3.1...3.14)
|
|
|
|
project(DummyImport CXX)
|
|
|
|
add_executable(with_private_target main.cpp)
|
|
target_include_directories(with_private_target PRIVATE ${nlohmann_json_source}/include)
|
|
set_target_properties(with_private_target PROPERTIES CXX_STANDARD 11)
|
|
|
|
add_executable(with_private_system_target main.cpp)
|
|
target_include_directories(with_private_system_target PRIVATE SYSTEM ${nlohmann_json_source}/include)
|
|
set_target_properties(with_private_system_target PROPERTIES CXX_STANDARD 11)
|
|
|
|
# regression from https://github.com/nlohmann/json/discussions/2281
|
|
add_library(Foo STATIC Foo.cpp Bar.cpp)
|
|
target_include_directories(Foo PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${nlohmann_json_source}/include)
|
|
set_target_properties(Foo PROPERTIES CXX_STANDARD 11)
|
|
|
|
add_library(Bar STATIC Bar.cpp)
|
|
target_link_libraries(Bar PRIVATE Foo)
|
|
target_include_directories(Bar PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${nlohmann_json_source}/include)
|
|
set_target_properties(Bar PROPERTIES CXX_STANDARD 11)
|