Skip to content

Commit

Permalink
Move to the modern CMake project version option
Browse files Browse the repository at this point in the history
This replaces the manual ad-hoc version variables we have used since
CMake 2.x (and GLFW 2.x lite).
  • Loading branch information
elmindreda committed May 17, 2019
1 parent 5c5963f commit a255e7a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 14 deletions.
11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
cmake_minimum_required(VERSION 3.0)

project(GLFW C)
project(GLFW VERSION 3.4.0 LANGUAGES C)

set(CMAKE_LEGACY_CYGWIN_WIN32 OFF)

if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()

set(GLFW_VERSION_MAJOR "3")
set(GLFW_VERSION_MINOR "4")
set(GLFW_VERSION_PATCH "0")
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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/glfw3.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit a255e7a

Please sign in to comment.