From the course: Advanced C++: Building Projects with CMake
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Handling build configuration-specific behavior - C++ Tutorial
From the course: Advanced C++: Building Projects with CMake
Handling build configuration-specific behavior
- [Instructor] We introduced generator expressions and used them to handle different compilers and platforms in our Image Lite project. Now, we'll take this a step further by adapting our build based on whether we're compiling for debug or release mode. This is useful because you might want different compiler flags, logging levels, or even dependencies based on the build type. For example, you may want extra logging and no optimization in debug mode, while release mode should be all about performance. CMake supports several standard build configurations, debug, optimized for debugging with minimal optimization and debug symbols, release, optimized for performance with maximum optimization and no debugging info, RelWithDebInfo, which is a release built with debugging information, MinSizeRel, optimized for minimal size. We specify the configuration at configure time by setting the CMake build type. Let's enhance our add image lite module function to support configuration-specific…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.