4
4
#
5
5
6
6
# CMake version
7
- cmake_minimum_required (VERSION 3.0 FATAL_ERROR)
7
+ cmake_minimum_required (VERSION 3.15 FATAL_ERROR)
8
8
9
9
10
10
#
@@ -28,33 +28,56 @@ endif()
28
28
include (cmake/Custom.cmake)
29
29
30
30
# 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.
37
38
38
39
# Include cmake modules
39
40
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
40
41
41
42
include (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)
53
45
54
46
# Include custom cmake modules
47
+ include (cmake/Coverage.cmake)
48
+ include (cmake/GenerateTemplateExportHeader.cmake)
55
49
include (cmake/GetGitRevisionDescription.cmake)
56
50
include (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 ()
58
81
59
82
60
83
#
@@ -68,33 +91,17 @@ set(META_AUTHOR_ORGANIZATION "CG Internals GmbH")
68
91
set (META_AUTHOR_DOMAIN "https://github.com/cginternals/glbinding/" )
69
92
set (META_AUTHOR_MAINTAINER
"[email protected] " )
70
93
set (META_VERSION_MAJOR "3" )
71
- set (META_VERSION_MINOR "4 " )
94
+ set (META_VERSION_MINOR "5 " )
72
95
set (META_VERSION_PATCH "0" )
73
96
set (META_VERSION_REVISION "${GIT_REV} " )
74
97
set (META_VERSION "${META_VERSION_MAJOR} .${META_VERSION_MINOR} .${META_VERSION_PATCH} " )
75
98
set (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" )
77
101
78
102
string (MAKE_C_IDENTIFIER ${META_PROJECT_NAME} META_PROJECT_ID)
79
103
string (TOUPPER ${META_PROJECT_ID} META_PROJECT_ID)
80
104
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
-
98
105
99
106
#
100
107
# Declare project
@@ -105,19 +112,13 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
105
112
set (IDE_FOLDER "" )
106
113
107
114
# Declare project
108
- project (${META_PROJECT_NAME} C CXX)
115
+ project (${META_PROJECT_NAME}
116
+ VERSION ${META_VERSION}
117
+ DESCRIPTION ${META_PROJECT_DESCRIPTION}
118
+ )
109
119
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)
121
122
122
123
# Set output directories
123
124
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} )
@@ -128,25 +129,24 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
128
129
file (WRITE "${PROJECT_BINARY_DIR} /VERSION" "${META_NAME_VERSION} " )
129
130
130
131
131
- #
132
- # Compiler settings and options
133
- #
134
-
135
- include (cmake/CompileOptions.cmake)
136
-
137
-
138
132
#
139
133
# Project Health Check Setup
140
134
#
141
135
142
136
# 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} )
144
138
145
139
# 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)
150
150
151
151
152
152
#
0 commit comments