]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
BUG: CMake 2.8.4 does not support required features
authorHans Johnson <hans-johnson@uiowa.edu>
Wed, 16 Jan 2019 15:13:36 +0000 (09:13 -0600)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 31 Jan 2019 12:07:20 +0000 (13:07 +0100)
CMake Error at CMakeLists.txt:682 (target_include_directories):
  Unknown CMake command "target_include_directories".

target_include_directories was introduced in cmake 3

C_STANDARD 99 support was added in cmake 3.1

Ubuntu 16.04 (Xenial) was distributed with cmake 3.5.1 by default.

CMake versions > 3.3 allow simplified implementations of modern
cmake compilation support.

===
For newer versions of cmake (upto a maximum validated version [3.13.2 in this case]),
use newer cmake policies available.  The newer policies often provide better
diagnostics for subtle build related issues.

CMakeLists.txt

index 67b1dc5f3c0ca1568b38849b33702ea83723b011..a946973399b15a4bb21312cbe2eb87edec4941d0 100644 (file)
@@ -1,4 +1,10 @@
-cmake_minimum_required(VERSION 2.8.4)
+cmake_minimum_required(VERSION 3.5.1)
+if(CMAKE_VERSION VERSION_LESS 3.12)
+  cmake_policy(VERSION ${CMAKE_VERSION})
+else()
+  cmake_policy(VERSION 3.5.1...3.13.2)
+endif()
+
 set(CMAKE_MACOSX_RPATH 1)
 
 project(zlib C)
@@ -20,13 +26,7 @@ include(CheckCSourceRuns)
 include(FeatureSummary)
 
 # Enable C99
-if (CMAKE_VERSION VERSION_LESS "3.1")
-    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
-        set (CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
-    endif ()
-else ()
-    set (CMAKE_C_STANDARD 99)
-endif ()
+set (CMAKE_C_STANDARD 99)
 
 # make sure we use an appropriate BUILD_TYPE by default, "Release" to be exact
 # this should select the maximum generic optimisation on the current platform (i.e. -O3 for gcc/clang)