From 990acb4e19b793146ccf44c05e7ea1a406d81d8e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 5 Sep 2023 12:14:46 +0200 Subject: [PATCH 1/3] CMake: remove needless policy setting These policies were all introduced before CMake 3.9, so they will automatically be initialized to the new behavior when requesting a minimum version of 3.9. --- CMakeLists.txt | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0115d4..2484d1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,23 +5,10 @@ # c++11, which isn't available on e.g HPUX. cmake_minimum_required(VERSION 3.9) -# The project() command manages VERSION variables. -cmake_policy(SET CMP0048 NEW) - # JSON-C library is C only project. # PROJECT_VERSION{,_MAJOR,_MINOR,_PATCH} set by project(): project(json-c LANGUAGES C VERSION 0.17.99) -# Targets may not link directly to themselves. -cmake_policy(SET CMP0038 NEW) - -# MACOSX_RPATH is enabled by default. -# We set it explicitly to avoid the warning -cmake_policy(SET CMP0042 NEW) - -# Only interpret if() arguments as variables or keywords when unquoted. -cmake_policy(SET CMP0054 NEW) - # set default build type if not specified by user if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) From 159822dd8a8752b84c4e5dab718c537b00eedde3 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 5 Sep 2023 14:27:27 +0200 Subject: [PATCH 2/3] CMake: request consistent minimum version --- tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f54840d..03c16dc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.9) add_executable(test1Formatted test1.c parse_flags.c parse_flags.h) target_compile_definitions(test1Formatted PRIVATE TEST_FORMATTED=1) target_link_libraries(test1Formatted PRIVATE ${PROJECT_NAME}) From c4a615a0523d5daa51538387fec4ca6a889314ad Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 5 Sep 2023 14:31:24 +0200 Subject: [PATCH 3/3] CMake: request all policies up to CMake 3.12 being set to NEW --- CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2484d1f..4ce1da9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ # and many OpenWRT packages require, much newer CMake packages. # We're stopping before 3.10 because that version starts requiring # c++11, which isn't available on e.g HPUX. -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.9...3.12) # JSON-C library is C only project. # PROJECT_VERSION{,_MAJOR,_MINOR,_PATCH} set by project(): @@ -16,13 +16,6 @@ endif() set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2") -# Include file check macros honor CMAKE_REQUIRED_LIBRARIES -# i.e. the check_include_file() calls will include -lm when checking. -# New in version 3.12. -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - include(CTest) # Set some packaging variables.