44#
55
66# CMake version
7- cmake_minimum_required (VERSION 3.0 FATAL_ERROR)
7+ cmake_minimum_required (VERSION 3.15 FATAL_ERROR)
88
99
1010#
@@ -28,33 +28,56 @@ endif()
2828include (cmake/Custom.cmake)
2929
3030# Set policies
31- set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
32- set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default.
33- set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types.
34- set_policy(CMP0069 NEW) # ENABLE CMP0069: INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
35- set_policy(CMP0072 NEW) # ENABLE CMP0072: FindOpenGL prefers GLVND by default when available.
36- set_policy(CMP0077 NEW) # ENABLE CMP0077: option() honors normal variables.
31+ set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
32+ set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default.
33+ set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types.
34+ set_policy(CMP0069 NEW) # ENABLE CMP0069: INTERPROCEDURAL_OPTIMIZATION is enforced when enabled.
35+ set_policy(CMP0072 NEW) # ENABLE CMP0072: FindOpenGL prefers GLVND by default when available.
36+ set_policy(CMP0077 NEW) # ENABLE CMP0077: option() honors normal variables.
37+ set_policy(CMP0120 OLD) # DISABLE CMP0120: The WriteCompilerDetectionHeader module is removed.
3738
3839# Include cmake modules
3940list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
4041
4142include (GenerateExportHeader)
42-
43- set (WriterCompilerDetectionHeaderFound NOTFOUND )
44- # This module is only available with CMake >=3.1, so check whether it could be found
45- # BUT in CMake 3.1 this module doesn't recognize AppleClang as compiler, so just use it as of CMake 3.2
46- if (${CMAKE_VERSION} VERSION_GREATER "3.2" )
47- include (WriteCompilerDetectionHeader OPTIONAL RESULT_VARIABLE WriterCompilerDetectionHeaderFound)
48- endif ()
49-
50- if (${CMAKE_VERSION} VERSION_GREATER "3.9" )
51- include (CheckIPOSupported OPTIONAL RESULT_VARIABLE CheckIPOSupportedFound)
52- endif ()
43+ include (WriteCompilerDetectionHeader)
44+ include (CheckIPOSupported OPTIONAL RESULT_VARIABLE CheckIPOSupportedFound)
5345
5446# Include custom cmake modules
47+ include (cmake/Coverage.cmake)
48+ include (cmake/GenerateTemplateExportHeader.cmake)
5549include (cmake/GetGitRevisionDescription.cmake)
5650include (cmake/HealthCheck.cmake)
57- include (cmake/GenerateTemplateExportHeader.cmake)
51+
52+ #
53+ # Project configuration options
54+ #
55+
56+ # Project options
57+ option (BUILD_SHARED_LIBS "Build shared instead of static libraries." ON )
58+ option (OPTION_SELF_CONTAINED "Create a self-contained install with all dependencies." OFF )
59+ option (OPTION_BUILD_TESTS "Build tests." OFF )
60+ option (OPTION_BUILD_DOCS "Build documentation." OFF )
61+ option (OPTION_BUILD_TOOLS "Build tools." ON )
62+ option (OPTION_BUILD_EXAMPLES "Build examples." ON )
63+ option (OPTION_BUILD_WITH_BOOST_THREAD "Use boost::thread instead of std::thread." OFF )
64+ option (OPTION_BUILD_CHECK "Enable source code check targets" OFF )
65+ option (OPTION_BUILD_OWN_KHR_HEADERS "Build and deploy glbinding with in-source KHR headers." OFF )
66+ option (OPTION_BUILD_WITH_LTO "Build with Link-time Optimization (may break AppleClang)" OFF )
67+ option (OPTION_USE_GIT_INFORMATION "Fetches commit information from the git source repository" ON )
68+ option (OPTION_ENABLE_COVERAGE "Add coverage information." OFF )
69+
70+ # Get git revision
71+ if (OPTION_USE_GIT_INFORMATION AND GLBINDING_BUILD_AS_ROOT)
72+ get_git_head_revision(GIT_REFSPEC GIT_SHA1)
73+ string (SUBSTRING "${GIT_SHA1} " 0 12 GIT_REV)
74+ if (NOT GIT_SHA1)
75+ set (GIT_REV "0" )
76+ endif ()
77+ else ()
78+ set (GIT_SHA1 "" )
79+ set (GIT_REV "0" )
80+ endif ()
5881
5982
6083#
@@ -68,33 +91,17 @@ set(META_AUTHOR_ORGANIZATION "CG Internals GmbH")
6891set (META_AUTHOR_DOMAIN "https://github.com/cginternals/glbinding/" )
6992set (META_AUTHOR_MAINTAINER
"[email protected] " )
7093set (META_VERSION_MAJOR "3" )
71- set (META_VERSION_MINOR "4 " )
94+ set (META_VERSION_MINOR "5 " )
7295set (META_VERSION_PATCH "0" )
7396set (META_VERSION_REVISION "${GIT_REV} " )
7497set (META_VERSION "${META_VERSION_MAJOR} .${META_VERSION_MINOR} .${META_VERSION_PATCH} " )
7598set (META_NAME_VERSION "${META_PROJECT_NAME} v${META_VERSION} (${META_VERSION_REVISION} )" )
76- set (META_CMAKE_INIT_SHA "c472829f01df4c99c7bd3fa96bcf6854b3dd44f1" )
99+ set (META_CMAKE_INIT_SHA "1915e8c3eb77bc67c14de7ced94f0623e889416a" )
100+ set (META_CMAKE_INIT_BRANCH "cmake-3.15" )
77101
78102string (MAKE_C_IDENTIFIER ${META_PROJECT_NAME} META_PROJECT_ID)
79103string (TOUPPER ${META_PROJECT_ID} META_PROJECT_ID)
80104
81- #
82- # Project configuration options
83- #
84-
85- # Project options
86- option (BUILD_SHARED_LIBS "Build shared instead of static libraries." ON )
87- option (OPTION_SELF_CONTAINED "Create a self-contained install with all dependencies." OFF )
88- option (OPTION_BUILD_TESTS "Build tests." OFF )
89- option (OPTION_BUILD_DOCS "Build documentation." OFF )
90- option (OPTION_BUILD_TOOLS "Build tools." ON )
91- option (OPTION_BUILD_EXAMPLES "Build examples." ON )
92- option (OPTION_BUILD_WITH_BOOST_THREAD "Use boost::thread instead of std::thread." OFF )
93- option (OPTION_BUILD_CHECK "Enable source code check targets" OFF )
94- option (OPTION_BUILD_OWN_KHR_HEADERS "Build and deploy glbinding with in-source KHR headers." OFF )
95- option (OPTION_BUILD_WITH_LTO "Build with Link-time Optimization (may break AppleClang)" OFF )
96- option (OPTION_USE_GIT_INFORMATION "Fetches commit information from the git source repository" ON )
97-
98105
99106#
100107# Declare project
@@ -105,19 +112,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
105112set (IDE_FOLDER "" )
106113
107114# Declare project
108- project (${META_PROJECT_NAME} C CXX)
115+ project (${META_PROJECT_NAME}
116+ VERSION ${META_VERSION}
117+ DESCRIPTION ${META_PROJECT_DESCRIPTION}
118+ )
109119
110- # Get git revision
111- if (OPTION_USE_GIT_INFORMATION AND GLBINDING_BUILD_AS_ROOT)
112- get_git_head_revision(GIT_REFSPEC GIT_SHA1)
113- string (SUBSTRING "${GIT_SHA1} " 0 12 GIT_REV)
114- if (NOT GIT_SHA1)
115- set (GIT_REV "0" )
116- endif ()
117- else ()
118- set (GIT_SHA1 "" )
119- set (GIT_REV "0" )
120- endif ()
120+ enable_language (C)
121+ enable_language (CXX)
121122
122123# Set output directories
123124set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} )
@@ -128,25 +129,24 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
128129file (WRITE "${PROJECT_BINARY_DIR} /VERSION" "${META_NAME_VERSION} " )
129130
130131
131- #
132- # Compiler settings and options
133- #
134-
135- include (cmake/CompileOptions.cmake)
136-
137-
138132#
139133# Project Health Check Setup
140134#
141135
142136# Add cmake-init template check cmake targets
143- add_check_template_target(${META_CMAKE_INIT_SHA} )
137+ add_check_template_target(${META_CMAKE_INIT_SHA} ${META_CMAKE_INIT_BRANCH} )
144138
145139# Configure health check tools
146- if (OPTION_BUILD_CHECK)
147- enable_cppcheck(On )
148- enable_clang_tidy(On )
149- endif ()
140+ enable_cppcheck(ON )
141+ enable_clang_tidy(ON )
142+ enable_coverage(${OPTION_ENABLE_COVERAGE} )
143+
144+
145+ #
146+ # Compiler settings and options
147+ #
148+
149+ include (cmake/CompileOptions.cmake)
150150
151151
152152#
0 commit comments