3.15. Build types

3.15.1. Detect Multi/Single

string(COMPARE EQUAL "${CMAKE_CFG_INTDIR}" "." is_single)
if(is_single)
  message("Single-configuration generator")
else()
  message("Multi-configuration generator")
endif()

CMake documentation

Warning

if(XCODE OR MSVC) condition doesn’t work because MSVC defined for NMake single-configuration generator too.

Warning

if(XCODE OR MSVC_IDE) condition doesn’t work because MSVC_IDE is not defined for Visual Studio MDD toolchain.