Build » Historie » Revize 2
Revize 1 (Václav Šíma, 2023-04-07 11:53) → Revize 2/11 (Václav Šíma, 2023-04-07 11:54)
h1. Build
h3. CMake build types
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.
The default configuration types supported by CMake are:
* *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.
* *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.
* *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.
* *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.
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.
In this project configuration type is configurable via: (limited to debug or release only)
<pre><code class="cpp">
CMAKE_CONFIGURATION_TYPES
</code></pre>
> *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* .
h3. Shared libraries
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.
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.
To enable shared library building with CMake, you can set the *@BUILD_SHARED_LIBS@* option to *@ON@* in your _CMakeLists.txt_ file