Ninja generator: NDEBUG is not defined for RC files in release mode
The test setup consists of a .cpp file and a .rc file that both output a message based on whether the
_DEBUG flags are set.
See attached file NDEBUG.zip
Both the .exe file description (from the .rc file) and the program output (from the .cpp file) agree on the definition of NDEBUG and _DEBUG.
With the Ninja generator, in Release mode, the NDEBUG macro is defined when compiling the .cpp file, but not when compiling the .rc file. With the MSBuild generator, the behavior is as expected.
Ninja generator, debug build: Output: _DEBUG is defined. File description: _DEBUG is defined. !! Ninja generator, release build: !! Output: NDEBUG is defined !! File description: Neither NDEBUG nor _DEBUG are defined. "Visual Studio 15 2017 Win64" generator, debug build: Output: _DEBUG is defined File description: _DEBUG is defined "Visual Studio 15 2017 Win64" generator, release build: Output: NDEBUG is defined File description: NDEBUG is defined
Using CMake 3.14.0 and Visual Studio 2017 on Windows 10.