From the course: Advanced C++: Building Projects with CMake

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Managing build configurations

Managing build configurations

- [Instructor] Another area where automation helps is managing different build configurations. Let's add the following lines to our top-level CMakeLists.txt. Let me close this one and scroll down to the bottom. The snippet sets the default build type to release if non-specified and reports the current build type during configuration. So let's reconfigure our project, cmake -B build. And here's the output. We can see the build type is now released. We can override this default by specifying a build type when running cmake. Cmake -D and let's set CMAKE_BUILD_TYPE to Debug. Now the build type is Debug. There are many other build tasks we could automate, such as resource compilation, converting images, sounds, or other assets into formats optimized for our application. Version information, generating version headers from git tags or other versioning information. Documentation, running tools like Doxygen to generate documentation as part of the build, or static analysis, integrating…

Contents