-
Notifications
You must be signed in to change notification settings - Fork 16
Selecting build types
Felipe Torrezan edited this page Apr 13, 2024
·
3 revisions
The IAR driver built into CMake provides different compiler optimization flags depending on the selected build type.
The CMake variable CMAKE_CONFIGURATION_TYPES provides four build configurations and also allows user custom build configurations.
As per CMake 3.28.1, the default build configuration types and their differences are:
Build configuration | Initial options for the IAR compiler |
---|---|
Debug |
-r |
Release |
-Oh -DNDEBUG |
RelWithDebInfo |
-Oh -DNDEBUG -r |
MinSizeRel |
-Ohz -DNDEBUG |
- Select the desired CMAKE_BUILD_TYPE at configure-time. For example, for building using high optimization for minimal binary size:
mkdir build-MinSizeRel
cd build-MinSizeRel
cmake .. -G Ninja --toolchain /path/to/your-iar-toolchain-file.cmake -DCMAKE_BUILD_TYPE=MinSizeRel
Note
When the project is built, the compiler will initially get the selected optimization flags (-Ohz -DNDEBUG
).
This is the cmake-tutorial wiki. Back to Wiki Home
- Setting language-specific target options
- Selecting build types
- Using Ninja Multi-Config
- Filing a build log
- Multi-file compilation
- Invoking IAR binary utilities