From 59055d585f2dd7fed4ff15bf2881bf7e13e0fa94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 26 Nov 2019 18:09:22 +0100 Subject: [PATCH] Update minimum required CMake version to 3.1 --- CMakeLists.txt | 2 +- README.md | 4 +++- examples/CMakeLists.txt | 12 +----------- src/CMakeLists.txt | 13 +------------ tests/CMakeLists.txt | 12 +----------- 5 files changed, 7 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 578abc0a..f87ec976 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.1) project(GLFW VERSION 3.4.0 LANGUAGES C) diff --git a/README.md b/README.md index 15370970..b2c3a7ca 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,8 @@ in the documentation for more information. ## Dependencies -GLFW itself depends only on the headers and libraries for your window system. +GLFW itself needs only CMake 3.1 or later and the headers and libraries for your +OS and window system. The (experimental) Wayland backend also depends on the `extra-cmake-modules` package, which is used to generated Wayland protocol headers. @@ -123,6 +124,7 @@ information on what to include when reporting a bug. - Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427) - Added `GLFW_RESIZE_NS_CURSOR` alias for `GLFW_VRESIZE_CURSOR` (#427) - Added `GLFW_POINTING_HAND_CURSOR` alias for `GLFW_HAND_CURSOR` (#427) + - Updated the minimum required CMake version to 3.1 - Disabled tests and examples by default when built as a CMake subdirectory - Bugfix: The CMake config-file package used an absolute path and was not relocatable (#1470) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7e633169..050dff02 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -17,17 +17,6 @@ elseif (APPLE) set(ICON glfw.icns) endif() -if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR - ${CMAKE_VERSION} VERSION_GREATER "3.1.0") - set(CMAKE_C_STANDARD 99) -else() - # Remove this fallback when removing support for CMake version less than 3.1 - add_compile_options("$<$:-std=c99>" - "$<$:-std=c99>" - "$<$:-std=c99>") - -endif() - set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h" "${GLFW_SOURCE_DIR}/deps/glad_gl.c") set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" @@ -55,6 +44,7 @@ set(GUI_ONLY_BINARIES boing gears heightmap particles sharing splitview set(CONSOLE_BINARIES offscreen) set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES + C_STANDARD 99 FOLDER "GLFW3/Examples") if (GLFW_USE_OSMESA) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cf82f0f6..5b3d2e1e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,20 +85,9 @@ set_target_properties(glfw PROPERTIES VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR} SOVERSION ${GLFW_VERSION_MAJOR} POSITION_INDEPENDENT_CODE ON + C_STANDARD 99 FOLDER "GLFW3") -if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR - ${CMAKE_VERSION} VERSION_GREATER "3.1.0") - - set_target_properties(glfw PROPERTIES C_STANDARD 99) -else() - # Remove this fallback when removing support for CMake version less than 3.1 - target_compile_options(glfw PRIVATE - "$<$:-std=c99>" - "$<$:-std=c99>" - "$<$:-std=c99>") -endif() - target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H) target_include_directories(glfw PUBLIC "$" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5571a3c9..275f20c1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,17 +20,6 @@ set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h" set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h" "${GLFW_SOURCE_DIR}/deps/tinycthread.c") -if (${CMAKE_VERSION} VERSION_EQUAL "3.1.0" OR - ${CMAKE_VERSION} VERSION_GREATER "3.1.0") - set(CMAKE_C_STANDARD 99) -else() - # Remove this fallback when removing support for CMake version less than 3.1 - add_compile_options("$<$:-std=c99>" - "$<$:-std=c99>" - "$<$:-std=c99>") - -endif() - add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL}) add_executable(events events.c ${GETOPT} ${GLAD_GL}) add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL}) @@ -66,6 +55,7 @@ set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen cursor) set_target_properties(${GUI_ONLY_BINARIES} ${CONSOLE_BINARIES} PROPERTIES + C_STANDARD 99 FOLDER "GLFW3/Tests") if (MSVC)