[CMake] How to remove debug target from Makefiles

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Wed Mar 15 03:32:38 EST 2006


> Von: "Alexander Neundorf" <a.neundorf-work at gmx.net>
> > Von: "Christian Ehrlicher" <Ch.Ehrlicher at gmx.de> 
> >  
> > Von: "Alexander Neundorf" <a.neundorf-work at gmx.net> 
> > > Hallo Christian :-),  
> > >   
> > > > Von: "Christian Ehrlicher" <Ch.Ehrlicher at gmx.de>  
> > > >   
> > > > Hi,  
> > > >   
> > > > Is there a way to disable the debug target from the makefile/vcproj 
> by 
> > > > modifiing CMakeLists.txt? I need it to avoid crashes when I link a  
> > > > release executable against my debug lib (this is msvc...). Or maybe 
> > > > give the debug lib a different name like Qt does (kdewin32d.dll 
> > instead  
> > > > kdewin32.dll)?   
> > > >   
> > > > Christian  
> > >   
> > > I suggested this on one of the kde mailing list, but giving debug 
> > > libs another name was dismissed (too unflexible).  
> > We need it just for kdewin32.dll ;-) 
> > > Which exact problems do you have and which behaviour do you need ?  
> > >   
> > The problem is that _get_osfhandle() from the (msvc-libc)debug version 
> > doesn't like fd's opened by the release version of _open()... it's just 
> > a mess. So I must avoid that we link against the debug version of 
> > kdewin32 (using kdewin32-release with a debug kde library seems to work 
> > - at least my testcase did not crash ;) ). 
>  
> You can set a different debug postfix using  
> SET(CMAKE_DEBUG_POSTFIX "_debug") 
> This will then be appended to the library names. You could use if (MSVC) 
> to do this only for msvc. When using this library later, you will have to 
> use 
>  
> set(KDEWIN32_LIBRARIES optimized kdewin32 debug kdewin32_debug) 
>  
> target_link_libraries(foo ${KDEWIN32_LIBRARIES}) 
>  
> Then kdewin32_debug.dll will be used when compiling in debug mode, and 
> kdewin32.dll will be used otherwise. 
> What should be done if only one of the two is available ? 
>
I would say that we only use the release version of kdewin32 for kdelibs -
if we have to debug there, we can use RelaseWithDebugInfo instead.

Christian

-- 
Bis zu 70% Ihrer Onlinekosten sparen: GMX SmartSurfer!
Kostenlos downloaden: http://www.gmx.net/de/go/smartsurfer


More information about the CMake mailing list