[CMake] strange behaviour of TARGET_LINK_LIBRARIES debug/optimized on MacOS

Hendrik Sattler post at hendrik-sattler.de
Wed Dec 10 07:45:05 EST 2008


Am Wednesday 10 December 2008 13:23:04 schrieb Clemens Arth:
> Clemens Arth wrote:
> > before I submit a bug report I wanted to ask you about some strange
> > behaviour of TARGET_LINK_LIBRARIES on MacOS 10.5 and CMake 2.6-2;
> >
> > A library is created for debug and release, named libFooD.dylib and
> > libFoo.dylib respectively. This works well. Then I create another
> > library in the following way:
> >
> > link_directories(${FooDir}/build/OSX)
> > add_library(Bar ${BarSources})
> > set_target_properties(Bar PROPERTIES
> >  DEBUG_OUTPUT_NAME BarD
> >  RELEASE_OUTPUT_NAME Bar
> > )

You make your life hard, see property DEBUG_POSTFIX

> > It is necessary to link foo to bar, which I thought should with either
> > of the following ways:
> >
> > TARGET_LINK_LIBRARIES(Bar Foo)
> >
> > As expected, this only works for Release and not for Debug due to the
> > appended "D" for the debug library. Changing Foo to FooD works only
> > for debug, not for release.
> > However that's the expected behaviour, but then I've tried the following:
> >
> > TARGET_LINK_LIBRARIES(Bar debug FooD optimized Foo)

Is Foo created using add_library()?

HS


More information about the CMake mailing list