[CMake] Create executable with no dynamic dependency at all

Jean-Pierre Bergamin james at ractive.ch
Thu May 7 06:11:18 EDT 2009


> I set -static flag in the top level CMakeLists.txt:
> 
> SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
> before ADD_SUBDIRECTORY.

I now tried:
set_target_properties(ui PROPERTIES LINK_FLAGS "-static")

This helps so that "-static" is used when linking. Good.

Now the only problem I have is that "-Wl,-Bdynamic
-Wl,-rpath,/usr/local/lib" is still added to the end of the linker
commandline - which is a bug, since no dynamic libs are linked.
Any ideas how to work-around this or how to track down why and where this
empty "-Wl,-Bdynamic" flag is added?


Thanks

James



> > May I ask what platform you are using? I just tried the
> > following simplest
> > example on FreeBSD 6 and on Ubuntu 8.10. On both platforms
> > I do not manage
> > to get a non-dyanamic executable. How do I get the
> > "-static" flag set?
> 
> 
> 
> 
> _______________________________________________
> 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




More information about the CMake mailing list