Reputation: 505
I have a project running on CMake 2.8.9, and use Visual Studio 2008 for building. In the CMakeLists.txt I switch the default runtime library for debug configuration to MTd:
set(CMAKE_CXX_FLAGS_DEBUG "/MTd")
Unfortunately, this line also causes switching the flag "Debug Information Format" to "Disabled", which means that I can't debug my project. :-(
If I remove the line from the CMakeLists.txt the runtime library is "MDd" and also the "Debug Information Format" is "Program Database (/Zi)". Does anybody know the reason or how to avoid the issue? Is there any workaround? Is it possible to set the missing flag via CMake?
Upvotes: 1
Views: 1892
Reputation: 15951
You likely only want to add that flag to the list of used flags instead of replacing the list of flags with the single token /MTd
.
To append /MTd
to the list of flags use
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
Upvotes: 4