CMake variable or property to discern betwen debug and release builds

build-processcmakevisual c++

I want to set a CMake variable differently for debug and release builds. I have tried to use CMAKE_CFG_INTDIR like this:

IF(${CMAKE_CFG_INTDIR} STREQUAL "Debug")
    SET(TESTRUNNER DllPlugInTesterd_dll)
ELSE(${CMAKE_CFG_INTDIR} STREQUAL "Debug")
    SET(TESTRUNNER DllPlugInTester_dll)
ENDIF(${CMAKE_CFG_INTDIR} STREQUAL "Debug")

But this variable evaluates to $(OUTDIR) at the time CMake does its thing.

Is there a CMake variable I can use to discern between debug and release builds, or something along the lines of how TARGET_LINK_LIBRARIES where one can specify debug and optimized libraries?

EDIT: I cannot use CMAKE_BUILD_TYPE since this is only supported by make based generators and I need to get this working with Visual Studio.

Best Answer

Try to use CMAKE_BUILD_TYPE instead

Related Topic