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
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to