[CMake] TARGET_LINK_LIBRARIES debug and optimized

Filipe Sousa filipe at ipb.pt
Sun Jul 3 16:32:58 EDT 2005


On Monday 13 June 2005 14:20, Ken Martin wrote:
> > I just notice that cmake from CVS ignore the "debug" argument in
> > TARGET_LINK_LIBRARIES.
> > The following code shows the problem:
> >
> > ADD_EXECUTABLE(dr main.cc)
> > TARGET_LINK_LIBRARIES(dr debug mylib_debug optimized mylib)
> >
> > *Using cmake from CVS (cmake version 2.1-20050611)*
> >
> > $ cmake -DCMAKE_BUILD_TYPE=release
>
> Should that be
> $ cmake -DCMAKE_BUILD_TYPE=Release
>
> > src/dr: src/dr.dir/main.o
> > src/dr: libs/libmylib_debug.a
> > src/dr: libs/libmylib.a
> > src/dr: src/dr.dir/build.make
> > 	@echo "Linking CXX executable src/dr"
> > 	c++      -O3 -DNDEBUG -fPIC $(dr_OBJECTS) $(dr_EXTERNAL_OBJECTS)
> > -o src/dr
> > -rdynamic -L/home/fsousa/tmp/dr/build/libs -lmylib
> > -Wl,-rpath,/home/fsousa/tmp/dr/build/libs
> >
> > $ cmake -DCMAKE_BUILD_TYPE=debug
>
> And...
> $ cmake -DCMAKE_BUILD_TYPE=Debug

Ok, the problem is in cmLocalGenerator::OutputLinkLibraries:

if(buildType == "DEBUG")
    {
    cmakeBuildType = cmTarget::DEBUG;
    }
if(buildType.size())
    {
    cmakeBuildType = cmTarget::OPTIMIZED;
    }

Shouldn't that be

if(buildType == "DEBUG")
    {
    cmakeBuildType = cmTarget::DEBUG;
    }
else if(buildType.size())
    {
    cmakeBuildType = cmTarget::OPTIMIZED;
    }

or


if(buildType == "DEBUG")
    {
    cmakeBuildType = cmTarget::DEBUG;
    }
else
    {
    cmakeBuildType = cmTarget::OPTIMIZED;
    }

so that default target is allways OPTIMIZED if CMAKE_BUILD_TYPE is empty?

-- 
Filipe Sousa
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20050703/4b02a063/attachment.pgp


More information about the CMake mailing list