how to get current build type for a multi-config generator ?

Hi, All:

I need to set a variable only under debug build. I can archive this in a single config generator by check CMAKE_BUILD_TYPE.


but how to do the same thing for a multi-config generator ?

Thank you.

In general, you can’t do the same thing for multi-config generators because the build type is not known during the configure run. It is only decided at build time.

I say “in general” because some variables are used to initialise target properties. If those target properties support generator expressions, then you can potentially use generator expressions in the variable value to give the config-specific behavior you are looking for. But for your specific example of CPACK_RPM_DEBUGINFO_PACKAGE, this is not the case.

Hi, Craig:

Thank you for your explaination.