[CMake] Problem ignoring libcmt.lib on Windows

Gooch, Allen agooch at bioware.com
Thu Oct 8 19:21:11 EDT 2009


I have a project with a shared library target on Windows XPsp3 with VS2005/VS2008 using CMake 2.6 patch 4.  It seems that CMake adds winmm.lib and libcmt.lib as a dependency automatically for me. I've tried to have this library ignored in one project, as it causes duplicate symbols.  Based on my perusal of the docs and the mailing lists, I've added the following to my CMakeLists.txt file:

set_target_properties (FooLib PROPERTIES LINK_FLAGS "/NODEFAULTLIB:\"libcmt.lib\"")

This does not seem to affect behavior.  When I open up the Linker->Input tab in my generated project's properties I still see libcmt.lib added to the end of "Additional Dependencies".  The Linker->Command Line tab shows the /NODEFAULTLIB:"libcmt.lib" in the "All options" pane, as well as the libcmt.lib at the end.  If I manually modify the "Additional Dependencies" field to remove libcmt.lib, my build completes as expected.

I've tried various ways to specify the library to ignore, including quoting the library name and omitting the .lib suffix with no success.  How do I achieve having libcmt.lib not show up in the "Additional Dependencies", or alternatively, have it actually ignored.

Many thanks in advance,

Allen Gooch
Senior Server Programmer, BioWare



More information about the CMake mailing list