From bc8b567d7cc15be15c18abd939c109637934da60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 8 May 2019 15:28:18 +0200 Subject: [PATCH] Move to the modern CMake project version option This replaces the manual ad-hoc version variables we have used since CMake 2.x (and GLFW 2.x lite). (cherry picked from commit a255e7ace6a1bbdd879df11916b0273ac207cffb) --- CMakeLists.txt | 11 ++--------- docs/Doxyfile.in | 2 +- examples/CMakeLists.txt | 2 +- src/CMakeLists.txt | 2 +- src/glfw3.pc.in | 2 +- tests/CMakeLists.txt | 2 +- 6 files changed, 7 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02462d7c..e959ca6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0) -project(GLFW C) +project(GLFW VERSION 3.3.1 LANGUAGES C) set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) @@ -8,13 +8,6 @@ if (POLICY CMP0054) cmake_policy(SET CMP0054 NEW) endif() -set(GLFW_VERSION_MAJOR "3") -set(GLFW_VERSION_MINOR "3") -set(GLFW_VERSION_PATCH "1") -set(GLFW_VERSION_EXTRA "") -set(GLFW_VERSION "${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR}") -set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA}") - set_property(GLOBAL PROPERTY USE_FOLDERS ON) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) @@ -328,7 +321,7 @@ configure_package_config_file(src/glfw3Config.cmake.in NO_CHECK_REQUIRED_COMPONENTS_MACRO) write_basic_package_version_file(src/glfw3ConfigVersion.cmake - VERSION ${GLFW_VERSION_FULL} + VERSION ${GLFW_VERSION} COMPATIBILITY SameMajorVersion) configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index 27ed92c4..7a0056df 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -32,7 +32,7 @@ PROJECT_NAME = "GLFW" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @GLFW_VERSION_FULL@ +PROJECT_NUMBER = @GLFW_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 98da2cd7..e0a9c2d6 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -70,7 +70,7 @@ if (APPLE) set_target_properties(${WINDOWS_BINARIES} PROPERTIES RESOURCE glfw.icns MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} - MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL} + MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION} MACOSX_BUNDLE_ICON_FILE glfw.icns MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 050ee9e0..1928670e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -95,7 +95,7 @@ endif() add_library(glfw ${glfw_SOURCES} ${glfw_HEADERS}) set_target_properties(glfw PROPERTIES OUTPUT_NAME ${GLFW_LIB_NAME} - VERSION ${GLFW_VERSION} + VERSION ${GLFW_VERSION_MAJOR}.${GLFW_VERSION_MINOR} SOVERSION ${GLFW_VERSION_MAJOR} POSITION_INDEPENDENT_CODE ON FOLDER "GLFW3") diff --git a/src/glfw3.pc.in b/src/glfw3.pc.in index 87423e1a..f74298d4 100644 --- a/src/glfw3.pc.in +++ b/src/glfw3.pc.in @@ -5,7 +5,7 @@ libdir=@CMAKE_INSTALL_FULL_LIBDIR@ Name: GLFW Description: A multi-platform library for OpenGL, window and input -Version: @GLFW_VERSION_FULL@ +Version: @GLFW_VERSION@ URL: https://www.glfw.org/ Requires.private: @GLFW_PKG_DEPS@ Libs: -L${libdir} -l@GLFW_LIB_NAME@ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 97da4684..7e944668 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -78,7 +78,7 @@ if (APPLE) set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STRING ${GLFW_VERSION} - MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION_FULL} + MACOSX_BUNDLE_LONG_VERSION_STRING ${GLFW_VERSION} MACOSX_BUNDLE_INFO_PLIST "${GLFW_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") endif()