mirror of
https://github.com/json-c/json-c.git
synced 2026-04-04 12:59:07 +08:00
Bump up the minimum cmake version to 3.9.
This gets us up to a version that supports features we're already using (i.e. add_compile_options), but stops short of a cmake that requires c++11, which some OSes still don't support. Closes issue #774
This commit is contained in:
@@ -1,41 +1,26 @@
|
|||||||
# Many projects still are stuck using CMake 2.8 in several places so it's good to provide backward support too. This is
|
# CMake 3.9 was released in 2017/07
|
||||||
# specially true in old embedded systems (OpenWRT and friends) where CMake isn't necessarily upgraded.
|
# As of 2023, many versions of Linux, NetBSD and FreeBSD provide,
|
||||||
# We set it to 2.8.12 as CMake currently indicates that support for versions below it will be removed
|
# and many OpenWRT packages require, much newer CMake packages.
|
||||||
# from a future version ("Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.")
|
# We're stopping before 3.10 because that version starts requiring
|
||||||
# 2.8.12 was released in 2013.
|
# c++11, which isn't available on e.g HPUX.
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
|
|
||||||
if(POLICY CMP0048)
|
# The project() command manages VERSION variables.
|
||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
endif()
|
|
||||||
|
|
||||||
# JSON-C library is C only project.
|
# JSON-C library is C only project.
|
||||||
if (CMAKE_VERSION VERSION_LESS 3.0)
|
# PROJECT_VERSION{,_MAJOR,_MINOR,_PATCH} set by project():
|
||||||
project(json-c)
|
project(json-c LANGUAGES C VERSION 0.16.99)
|
||||||
set(PROJECT_VERSION_MAJOR "0")
|
|
||||||
set(PROJECT_VERSION_MINOR "16")
|
|
||||||
set(PROJECT_VERSION_PATCH "99")
|
|
||||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
|
||||||
else()
|
|
||||||
project(json-c LANGUAGES C VERSION 0.16.99)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# If we've got 3.0 then it's good, let's provide support. Otherwise, leave it be.
|
# Targets may not link directly to themselves.
|
||||||
if(POLICY CMP0038)
|
cmake_policy(SET CMP0038 NEW)
|
||||||
# Policy CMP0038 was introduced in CMake 3.0
|
|
||||||
cmake_policy(SET CMP0038 NEW)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(POLICY CMP0042)
|
# MACOSX_RPATH is enabled by default.
|
||||||
# Policy CMP0042 was introduced in CMake 3.0
|
# We set it explicitly to avoid the warning
|
||||||
# CMake version 3.25.1 warns when the policy is not set and uses OLD behavior
|
cmake_policy(SET CMP0042 NEW)
|
||||||
# We set it explicitly to avoid the warning
|
|
||||||
cmake_policy(SET CMP0042 OLD)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(POLICY CMP0054)
|
# Only interpret if() arguments as variables or keywords when unquoted.
|
||||||
cmake_policy(SET CMP0054 NEW)
|
cmake_policy(SET CMP0054 NEW)
|
||||||
endif()
|
|
||||||
|
|
||||||
# set default build type if not specified by user
|
# set default build type if not specified by user
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
@@ -46,6 +31,7 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
|
|||||||
|
|
||||||
# Include file check macros honor CMAKE_REQUIRED_LIBRARIES
|
# Include file check macros honor CMAKE_REQUIRED_LIBRARIES
|
||||||
# i.e. the check_include_file() calls will include -lm when checking.
|
# i.e. the check_include_file() calls will include -lm when checking.
|
||||||
|
# New in version 3.12.
|
||||||
if(POLICY CMP0075)
|
if(POLICY CMP0075)
|
||||||
cmake_policy(SET CMP0075 NEW)
|
cmake_policy(SET CMP0075 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user