diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ebbd468a..1a70ef2b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,25 +23,7 @@ # DEALINGS IN THE SOFTWARE. # -cmake_minimum_required(VERSION 2.8.12) - -# CMake policies. 0025 needs to be before project(), so putting all there. -# Use AppleClang instead of Clang on Apple -if(POLICY CMP0025) - cmake_policy(SET CMP0025 NEW) -endif() -# Don't treat imported targets with :: as files -if(POLICY CMP0028) - cmake_policy(SET CMP0028 NEW) -endif() -# Enable MACOSX_RPATH by default -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) -endif() -# Quoted variables should not be dereferenced -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() +cmake_minimum_required(VERSION 3.1) # Configuration fails on < 3.4 if only C++ is enabled (CheckFunctionExists # macro called from FindX11). Also, Android needs C for compiling some glue diff --git a/doc/building.dox b/doc/building.dox index 8b2017353..a46ea12f6 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -40,7 +40,7 @@ Minimal set of tools and libraries required for building is: - C++ compiler with good C++11 support. Compilers which are tested to have everything needed are **GCC** >= 4.8.1, **Clang** >= 3.3 and **MSVC** >= 2015. On Windows you can also use **MinGW-w64**. -- **CMake** >= 2.8.12 +- **CMake** >= 3.1 - **Corrade** --- Plugin management and utility library. See @ref building-corrade "Corrade download and installation guide" for more information. diff --git a/doc/changelog.dox b/doc/changelog.dox index bda42a419..a0b0cac54 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -43,6 +43,10 @@ See also: - Minimal supported GCC version is now 4.8.1, GCC 4.7 is not supported anymore. Minimal Clang version is now 3.3, since that's the first version with a complete C++11 support. +- Minimal supported CMake version is now 3.1. Older versions are not + supported anymore and all workarounds for them were removed. Download a + prebuilt release of a newer version if you need to use Corrade on older + systems (such as Ubuntu 14.04 or Debian 8). @subsection changelog-latest-new New features diff --git a/doc/generated/CMakeLists.txt b/doc/generated/CMakeLists.txt index cc77c5f34..e634cd5af 100644 --- a/doc/generated/CMakeLists.txt +++ b/doc/generated/CMakeLists.txt @@ -23,7 +23,8 @@ # DEALINGS IN THE SOFTWARE. # -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1) + project(MagnumDocumentationImageGenerator) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/../../modules/") diff --git a/doc/getting-started.dox b/doc/getting-started.dox index c11314dbc..a1e3755f3 100644 --- a/doc/getting-started.dox +++ b/doc/getting-started.dox @@ -70,7 +70,7 @@ these two new subdirectories using @cmake add_subdirectory() @ce so the file looks like this: @code{.cmake} -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.1) project(MyApplication) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/") diff --git a/modules/FindEGL.cmake b/modules/FindEGL.cmake index 5cdccb1cc..a1c4f47b7 100644 --- a/modules/FindEGL.cmake +++ b/modules/FindEGL.cmake @@ -77,9 +77,6 @@ if(NOT TARGET EGL::EGL) IMPORTED_LOCATION ${EGL_LIBRARY}) endif() else() - # This won't work in CMake 2.8.12, but that affects Emscripten only so - # I assume people building for that are not on that crap old Ubuntu - # 14.04 LTS add_library(EGL::EGL INTERFACE IMPORTED) endif() diff --git a/modules/FindGLFW.cmake b/modules/FindGLFW.cmake index 96984b4d9..b5499f886 100644 --- a/modules/FindGLFW.cmake +++ b/modules/FindGLFW.cmake @@ -78,23 +78,7 @@ find_package_handle_standard_args("GLFW" DEFAULT_MSG GLFW_INCLUDE_DIR) if(NOT TARGET GLFW::GLFW) - # CMake 3.0 doesn't propagate the local target as dependency upwards - # the tree and then complains that GLFW::GLFW target was not found, - # which it shouldn't. This is reproducible with the base bootstrap - # project *and* when using Magnum as CMake subproject. Works with both - # 2.8.12 and 3.1, so I'm assuming this is a CMake 3.0 bug. The - # workaround is to make the target GLOBAL so it's propagated upwards - # the tree unconditionally. For some reason, UNKNOWN targets can't be - # marked as GLOBAL, so I'm biting the bullet and saying the library is - # shared -- CMake 3.0 is only on Debian Jessie now and I'm assuming GLFW - # comes from system package, which *should be* shared. Hopefully this won't - # bite back in the future. - if(CMAKE_VERSION VERSION_GREATER "2.8.12.2" AND CMAKE_VERSION VERSION_LESS "3.1.0") - set(_GLFW_IMPORTED_LIBRARY_KIND SHARED IMPORTED GLOBAL) - else() - set(_GLFW_IMPORTED_LIBRARY_KIND UNKNOWN IMPORTED) - endif() - add_library(GLFW::GLFW ${_GLFW_IMPORTED_LIBRARY_KIND}) + add_library(GLFW::GLFW UNKNOWN IMPORTED) # Work around BUGGY framework support on macOS # https://cmake.org/Bug/view.php?id=14105 diff --git a/modules/FindOpenGLES2.cmake b/modules/FindOpenGLES2.cmake index cd182ab67..8aa0ded71 100644 --- a/modules/FindOpenGLES2.cmake +++ b/modules/FindOpenGLES2.cmake @@ -78,9 +78,6 @@ if(NOT TARGET OpenGLES2::OpenGLES2) IMPORTED_LOCATION ${OPENGLES2_LIBRARY}) endif() else() - # This won't work in CMake 2.8.12, but that affects Emscripten only so - # I assume people building for that are not on that crap old Ubuntu - # 14.04 LTS add_library(OpenGLES2::OpenGLES2 INTERFACE IMPORTED) endif() diff --git a/modules/FindOpenGLES3.cmake b/modules/FindOpenGLES3.cmake index 4cb46eea8..617469313 100644 --- a/modules/FindOpenGLES3.cmake +++ b/modules/FindOpenGLES3.cmake @@ -82,9 +82,6 @@ if(NOT TARGET OpenGLES3::OpenGLES3) IMPORTED_LOCATION ${OPENGLES3_LIBRARY}) endif() else() - # This won't work in CMake 2.8.12, but that affects Emscripten only so - # I assume people building for that are not on that crap old Ubuntu - # 14.04 LTS add_library(OpenGLES3::OpenGLES3 INTERFACE IMPORTED) endif() diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index d0ad7357b..6655e10c6 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -112,23 +112,7 @@ find_package_handle_standard_args("SDL2" DEFAULT_MSG if(NOT TARGET SDL2::SDL2) if(SDL2_LIBRARY_NEEDED) - # CMake 3.0 doesn't propagate the local target as dependency upwards - # the tree and then complains that SDL2::SDL2 target was not found, - # which it shouldn't. This is reproducible with the base bootstrap - # project *and* when using Magnum as CMake subproject. Works with both - # 2.8.12 and 3.1, so I'm assuming this is a CMake 3.0 bug. The - # workaround is to make the target GLOBAL so it's propagated upwards - # the tree unconditionally. For some reason, UNKNOWN targets can't be - # marked as GLOBAL, so I'm biting the bullet and saying the library is - # shared -- CMake 3.0 is only on Debian Jessie now and I'm assuming SDL - # comes from system libsdl2-dev package, which *is* shared. Hopefully - # this won't bite back in the future. - if(CMAKE_VERSION VERSION_GREATER "2.8.12.2" AND CMAKE_VERSION VERSION_LESS "3.1.0") - set(_SDL2_IMPORTED_LIBRARY_KIND SHARED IMPORTED GLOBAL) - else() - set(_SDL2_IMPORTED_LIBRARY_KIND UNKNOWN IMPORTED) - endif() - add_library(SDL2::SDL2 ${_SDL2_IMPORTED_LIBRARY_KIND}) + add_library(SDL2::SDL2 UNKNOWN IMPORTED) # Work around BUGGY framework support on macOS # https://cmake.org/Bug/view.php?id=14105 @@ -169,9 +153,6 @@ if(NOT TARGET SDL2::SDL2) INTERFACE_LINK_LIBRARIES EGL::EGL) endif() else() - # This won't work in CMake 2.8.12, but that affects Emscripten only so - # I assume people building for that are not on that crap old Ubuntu - # 14.04 LTS add_library(SDL2::SDL2 INTERFACE IMPORTED) endif() diff --git a/package/ci/travis.yml b/package/ci/travis.yml index 71be410c1..76d4aed85 100644 --- a/package/ci/travis.yml +++ b/package/ci/travis.yml @@ -7,7 +7,6 @@ addons: - g++-4.8 - ninja-build - lcov - - "libc6:i386" # CMake 2.8.12 is 32bit - libsdl2-dev - freeglut3-dev - libopenal-dev @@ -190,15 +189,14 @@ install: - if [ "$WITH_GLUTAPPLICATION" != "ON" ]; then export WITH_GLUTAPPLICATION=OFF; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! "$TARGET" == "desktop-vulkan" ]; then export PLATFORM_GL_API=GLX; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "android" ]; then wget -nc https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip && unzip -q android-*.zip; fi -# Download CMake 2.8.12 to ensure we're still compatible with it (Travis has +# Download CMake 3.1.3 to ensure we're still compatible with it (Travis has # 3.9 since December 2017). Also, the PATH setting can't be cached, so it's -# separate (bit me two times already). ASan doesn't like when 32bit libraries -# are running, so for it we use the preinstalled CMake. Android needs CMake -# 3.7, but https://gitlab.kitware.com/cmake/cmake/issues/17253 is fixed in -# 3.9.2, so grab that. -- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! "$TARGET" == "desktop-sanitizers" ] && [ ! "$TARGET" == "android" ] && [ ! "$TARGET" == "desktop-vulkan" ] && [ ! -e "$HOME/cmake/bin" ]; then cd $HOME ; wget -nc --no-check-certificate https://cmake.org/files/v2.8/cmake-2.8.12.2-Linux-i386.tar.gz && mkdir -p cmake && cd cmake && tar --strip-components=1 -xzf ../cmake-2.8.12.2-Linux-i386.tar.gz && cd $TRAVIS_BUILD_DIR ; fi +# separate (bit me two times already). Android needs CMake 3.7, but +# https://gitlab.kitware.com/cmake/cmake/issues/17253 is fixed in 3.9.2, so +# grab that. FindVulkan is since 3.7, in that case just use the system package. +- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! "$TARGET" == "desktop-vulkan" ] && [ ! "$TARGET" == "android" ] && [ ! -e "$HOME/cmake/bin" ]; then cd $HOME ; wget -nc --no-check-certificate https://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz && mkdir -p cmake && cd cmake && tar --strip-components=1 -xzf ../cmake-3.1.3-Linux-x86_64.tar.gz && cd $TRAVIS_BUILD_DIR ; fi - if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "android" ] && [ ! -e "$HOME/cmake/bin" ]; then cd $HOME ; wget -nc --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.2-Linux-x86_64.tar.gz && mkdir -p cmake && cd cmake && tar --strip-components=1 -xzf ../cmake-3.9.2-Linux-x86_64.tar.gz && cd $TRAVIS_BUILD_DIR ; fi -- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! "$TARGET" == "desktop-vulkan" ] && [ ! "$TARGET" == "desktop-sanitizers" ]; then export PATH=$HOME/cmake/bin:$PATH && cmake --version; fi +- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! "$TARGET" == "desktop-vulkan" ]; then export PATH=$HOME/cmake/bin:$PATH && cmake --version; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install ninja; fi - if [ "$TRAVIS_OS_NAME" == "osx" ] && [[ "$CMAKE_CXX_FLAGS" == *"--coverage"* ]]; then HOMEBREW_NO_AUTO_UPDATE=1 brew install lcov; fi - if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then export PLATFORM_GL_API=CGL; fi diff --git a/package/debian/control b/package/debian/control index 42174ffbd..666f49a71 100644 --- a/package/debian/control +++ b/package/debian/control @@ -1,7 +1,7 @@ Source: magnum Priority: optional Maintainer: Vladimír Vondruš -Build-Depends: debhelper (>= 9), cmake (>= 2.8.12), corrade-dev, libgl-dev, libopenal-dev, libsdl2-dev +Build-Depends: debhelper (>= 9), cmake (>= 3.1), corrade-dev, libgl-dev, libopenal-dev, libsdl2-dev Standards-Version: 3.9.2 Section: libs Homepage: https://magnum.graphics