How to determine build type?

Hello all!

My CMake project is for iOS and using XCode generator. For now there are troubles with getting build type. The command that calling CMake is:

cmake --build /Project/build/iOS_Simulator --target ALL_BUILD --config Release
cmake --build /Project/build/iOS_Simulator --target ALL_BUILD --config Debug

How to determine value of the parameter “config“ inside of CMake file? Need to know which type of configs is using Debug or Release.

The config cannot be known at configure time because it is specified only at build time.

So, the only way to know what is the current config is to use the generator expression $<CONFIG> and the various variants.

1 Like