[cmake-developers] GCC link options

Brad King brad.king at kitware.com
Mon Jul 23 17:45:55 EDT 2012


On 07/23/2012 02:31 PM, J Decker wrote:
> In this commit --no-whole-archive is artificially added to compile
> options in Modules/Platform/Windows-GNU.cmake.
> 
> http://cmake.org/gitweb?p=cmake.git;a=commit;h=5f05a3c25e1480648f46c9ccbf775225f9e8e32d
> 
> This is causes no end of problems for me; because I have code which is
> indirectly referenced such that LD doesn't identify it as being used.

By what mechanism is code "indirectly referenced" such that
references are not visible to the linker?

Depending on your use case consider the object library feature:

 http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library

> any idea how I can get around the --no-whole-archive flag?

target_link_libraries(my_target -Wl,--whole-archive my_archive)

-Brad



More information about the cmake-developers mailing list