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

Clemens Arth clemens.arth at gmx.at
Wed Dec 10 07:23:04 EST 2008


Clemens Arth wrote:
> Hi,
>
> 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
> )
>
> 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)
>
> This does not work and it refuses to link in Release searching for 
> FooD and in Debug searching for Foo - taking the contrary libraries 
> for the configurations. Trying to outfox by setting debug to Foo and 
> optimized to FooD does not work either. Also splitting it up to
>
> TARGET_LINK_LIBRARIES(Bar debug FooD)
> TARGET_LINK_LIBRARIES(Bar optimized Foo)
>
> does not work. Did I miss something essential or does anybody has an 
> answer to this issue? I'm not using the latest cvs content, so might 
> this be an issue already fixed?
>
> Regards,
> Clemens
>
>
Now I've tried it with a fresh checkout from cvs - same result, so the 
error is also in the current source tree.

Regards
Clemens




More information about the CMake mailing list