Build info » Historie » Verze 2
Václav Šíma, 2023-04-22 22:18
1 | 1 | Václav Šíma | h1. Build info |
---|---|---|---|
2 | 2 | Václav Šíma | |
3 | Basic instructions and other useful information that I wrote down while debugging the superbuild. |
||
4 | |||
5 | h3. CMake build types |
||
6 | |||
7 | CMake configuration types are a set of build configurations that can be used to control how CMake generates build files for a particular project. Configuration types allow you to specify different build settings and options depending on the desired output of the build process. |
||
8 | The default configuration types supported by CMake are: |
||
9 | |||
10 | * *Debug* : A configuration that enables debugging and optimization options, and includes debugging symbols in the generated executable. This configuration is typically used for development and testing purposes. |
||
11 | * *Release* : A configuration that optimizes the generated executable for speed and size, and does not include debugging symbols. This configuration is typically used for production releases of the software. |
||
12 | * *RelWithDebInfo* : A configuration that optimizes the generated executable for speed and size, but also includes debugging symbols. This configuration is useful for debugging production releases. |
||
13 | * *MinSizeRel* : A configuration that optimizes the generated executable for minimal size, and does not include debugging symbols. This configuration is useful for embedded systems or other situations where small executable size is a priority. |
||
14 | |||
15 | In addition to these default configurations, CMake also allows you to define your own custom configuration types, which can be tailored to specific build requirements or scenarios. |
||
16 | |||
17 | In this project configuration type is configurable via: (limited to debug or release only) |
||
18 | <pre><code class="cpp"> |
||
19 | CMAKE_CONFIGURATION_TYPES |
||
20 | </code></pre> |
||
21 | > *Since Debug and Release builds have different optimizations, they may have different behavior and produce different results. For example, code that works correctly in Debug mode may not work correctly in Release mode due to optimizations that change the behavior of the code* . |
||
22 | |||
23 | |||
24 | h3. Whare are shared libraries? |
||
25 | |||
26 | A shared library is a type of library that is linked to an executable at runtime, rather than at compile time. This allows multiple programs to share the same library code, which can reduce the amount of disk space used and improve performance. Shared libraries are typically used on systems that support dynamic linking, such as Linux and macOS. |
||
27 | |||
28 | By default, CMake generates build files that produce static libraries. Static libraries are linked to an executable at compile time, which means that each program that uses the library has its own copy of the library code. Static libraries can be useful in situations where you want to create a self-contained executable that does not depend on any external libraries. |
||
29 | |||
30 | To enable shared library building with CMake, you can set the *@BUILD_SHARED_LIBS@* option to *@ON@* in _CMakeLists.txt_ file |
||
31 | |||
32 | h3. Building modes |
||
33 | |||
34 | CMake provides four different modes for handling the rebuilding of CMake-generated files: |
||
35 | |||
36 | * *"Ask"* : In "Ask" mode, CMake will prompt the user for confirmation before regenerating the build files. This mode is useful when the user wants to have control over when the build files are regenerated. |
||
37 | * *"Auto"* : In "Auto" mode, CMake will automatically regenerate the build files if they are out of date. This mode is useful for most cases, as it automates the process of updating the build files when changes are made to the project files. |
||
38 | * *"Always"* : In "Always" mode, CMake will always regenerate the build files, regardless of whether they are out of date or not. This mode is useful when the user wants to ensure that the build files are always up to date, but can be slower as it regenerates the build files even when they are not needed. |
||
39 | * *"Never"* : In "Never" mode, CMake will never regenerate the build files, even if they are out of date. This mode is useful when the user wants to prevent CMake from modifying the build files, such as when working with a read-only file system or when manually managing the build files. |