[Cmake] Adding /NODEFAULTLIB:msvcrt.lib to debug builds

NTR niels_tr at hotmail.com
Fri Apr 11 07:11:38 EDT 2003


Hi,

I'm trying to add /NODEFAULTLIB:msvcrt.lib to debug builds using:
  SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}
/NODEFAULTLIB:msvcrt.lib ")
  SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}
/NODEFAULTLIB:msvcrt.lib ")
However this doesn't seem to work. Doing the same for all builds using
works:
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}
/NODEFAULTLIB:msvcrt.lib ")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}
/NODEFAULTLIB:msvcrt.lib ")
But evidentally also removes the library from release builds ... causing
linking errors

So my question is how do I add the /NODEFAULTLIB:msvcrt.lib to debug builds
only?

In addition, I have a separate question. How can I add *.hpp header files to
the source list of my project, so that these are displayed in the VC++ 6
projects. Right now, I'm only including *.cpp files to the source list,
which makes it a little tedious to open corresponding *.hpp files as these
aren't in the project files list.

Regards,
Niels



More information about the CMake mailing list