I've read similar questions on stackoverflow but none of the answers did solve my problem.
I need to compile with /MDd
flag and here is my CMake command: (note the bolded /MDd
flag)
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=C:/temp -DCMAKE_C_FLAGS="-Zi -W4 -WX- -Od -Oy- -D_WIN32 -DWIN32=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -D_CRT_SECURE_NO_WARNINGS=1 -D_SCL_SECURE_NO_WARNINGS=1 -D_MBCS -GF- -Gm -EHsc -RTCc -RTC1 -MDd -GS -Gy- -Qpar- -fp:precise -fp:except -Zc:wchar_t -Zc:forScope -GR -Gd -analyze- -errorReport:prompt"
This is the output when executing nmake :
cl : Command line warning D9025 : overriding '/MDd' with '/MTd' cl : Command line warning D9025 : overriding '/W4' with '/W3'
Can somebody enlighten me as to what am I doing wrong here?
You'll probably find that somewhere in your CMakeLists.txt you have something like:
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W3 /MTd")
CMake appends the build-specific CMAKE_C_FLAGS_DEBUG
flags to the general CMAKE_C_FLAGS
, so your list of flags which is ultimately passed to the compiler contains:
... /MDd ... /MTd ...
and ... /W4 ... /W3 ...
.
The right-most values override the previous ones and generate the warnings. To fix this, you just need to modify the CMakeLists.txt to not apply those incorrect flags.
Less likely is that the variable CMAKE_C_FLAGS
is being manipulated in the CMakeLists.txt, but you can always check that too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With