You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As some modules as `WriteCompilerDetectionHeader` may not be available, cmake-init suggests to use fallbacks and availability detection.
128
132
133
+
Using this example, the module include
134
+
135
+
```cmake
136
+
include(WriteCompilerDetectionHeader)
137
+
```
138
+
139
+
is replaced by
140
+
129
141
```cmake
130
142
set(WriterCompilerDetectionHeaderFound NOTFOUND)
131
143
# This module is only available with CMake >=3.1, so check whether it could be found
@@ -135,12 +147,97 @@ if (${CMAKE_VERSION} VERSION_GREATER "3.2")
135
147
endif()
136
148
```
137
149
138
-
### CMake Backward Compatibility
150
+
and the result can be later used with
151
+
152
+
```cmake
153
+
if (WriterCompilerDetectionHeaderFound)
154
+
# ...
155
+
endif ()
156
+
```
157
+
158
+
Another issue with older CMake versions is the unavailability of then-unpublished language standards (e.g., C++11 and CMake 3.0). For those versions, the compile options has to be extended manually.
159
+
160
+
For new projects, we suggest to require at least CMake 3.2 and to therefore adjust the minimum required version:
161
+
162
+
```cmake
163
+
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
164
+
```
165
+
139
166
140
167
### Project Meta Information
141
168
169
+
The declaration of project-wide information--that are used, e.g., within documentation, testing, and deployment--, is combined within the project meta information section in the main `CMakeLists.txt`.
*cmake-init* supports the projects name, description, organization, domain, and maintainer email as well as detailed version information. For the version, we suggest to use [semantic versioning](https://semver.org/).
195
+
Depending on your version control system, you may want to integrate the current revision of the software as well: see [Version Control System Integration](#version-control-system-integration). If you use the [cmake-init Template Check](#cmake-init-template-check) module, the cmake-init SHA is declared within this section, too.
196
+
197
+
Last, *cmake-init* derives a project ID that complies with the naming schemes of C to be used within auto-generated and derived source code content (e.g., macro identifiers).
198
+
199
+
142
200
### Project Meta Information Code Generation
143
201
202
+
The result of this module is the generation of a C header file that propagates the project meta information to your C and C++ projects.
203
+
For this, the CMake file configuration feature is used on the `version.h.in` header template.
The template file is configured with the project meta information and the result is stored within the build directory. Beware that this header is stored in a path derived from your project name. You should adopt this as required.
0 commit comments