[CMake] Win32 linker line problems...

Lars Pechan lars.pechan at parkerpechan.com
Tue Apr 19 02:13:37 EDT 2005


Hello,
I use CMake in a project where I build lots of static libs that are 
later linked together to an app. In order to check this app for leaks I 
use VisualLeakDetector 
(http://www.codeproject.com/useritems/visualleakdetector.asp) which 
requires the app to be compiled with /MTd. This causes some problems in 
a few places and I end up with multiply defined stuff from the C 
runtime libs so I set up

CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG

to all be "/debug /NODEFAULTLIB:LIBCMT.LIB /FORCE:MULTIPLE".

This works fine when using the NMake Makefiles generator. 
Unfortunately, when using the "Visual Studio 7.NET 2003" generator 
these settings seem to be ignored. In Visual Studio I can't see my 
flags having any effect at all when I look in the linker properties. 
Not sure why but I was under the impression that these flags should 
just be added to the linker command line options?

I set the variables in a cache file that loads when the build-directory 
is generated. I can see the vars from CMakeSetup.

I've seen the same behaviour on CMake 2.0.6, CMakeCVS-20050330 and 
CMakeCVS-20050415.

Thanks for your help.

/Lars




More information about the CMake mailing list