From: Hans Johnson Date: Wed, 16 Jan 2019 15:13:36 +0000 (-0600) Subject: BUG: CMake 2.8.4 does not support required features X-Git-Tag: 1.9.9-b1~534 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b211125c7620edd1f0c138a735a14309bcd8202c;p=thirdparty%2Fzlib-ng.git BUG: CMake 2.8.4 does not support required features 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. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 67b1dc5f..a9469733 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)