[CMake] Unix makefiles feature request
Brad King
brad.king at kitware.com
Wed Jun 24 13:27:11 EDT 2009
Tyler Roscoe wrote:
> On Wed, Jun 24, 2009 at 11:38:56AM -0400, Brad King wrote:
>> Flags can be passed to target_link_libraries too:
>>
>> add_library(A STATIC a.c)
>> add_library(B STATIC b.c)
>> add_executable(main main.c)
>> target_link_libraries(main -Wl,--start-group A B -Wl,--end-group)
>
> This is cool and I did not know it. I also don't see it in the
> documentation. Maybe you could add an example similar to what you wrote
> above to the docs for target_link_libraries()?
Actually this was added in CVS HEAD in February. I've scheduled the
patch for inclusion in 2.6.5.
>> CMake 2.6 also supports circular dependencies for static libraries:
>>
>> add_library(A STATIC a.c)
>> add_library(B STATIC b.c)
>> target_link_libraries(A B)
>> target_link_libraries(B A)
>> add_executable(main main.c)
>> target_link_libraries(main A)
>>
>> The link line will contain
>>
>> ... -o main libA.a libB.a libA.a libB.a
>
> I feel like I've read this somewhere (the book perhaps?) but I also
> can't find this in the command docs. Another snippet to add.
Done, and also scheduled for 2.6.5.
-Brad
More information about the CMake
mailing list