[CMake] Unix makefiles feature request

Tyler Roscoe tyler at cryptio.net
Wed Jun 24 11:57:03 EDT 2009


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()?

> 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.

tyler


More information about the CMake mailing list