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 a255e7ace6)
This commit is contained in:
Camilla Löwy 2019-05-08 15:28:18 +02:00
parent 37cc51b823
commit bc8b567d7c
6 changed files with 7 additions and 14 deletions

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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")

View File

@ -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@

View File

@ -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()