Marcel Loose wrote:
I'm really struggling to build statically linked executables with CMake (also see my previous post with subject: Static linking and find_library).
I've answered in that thread.
Furthermore I added the '-static' flag to the linker with SET(CMAKE_EXE_LINKER_FLAGS -static).
Good.
In the mean time, is there a way to get rid of these spurious -Wl,-Bdynamic and -Wl,-Bstatic flags?
CMake is adding those because it doesn't know anything special about -static. It just assumes that all "-l" options should prefer shared libs in all cases. You can make sure it ends with -Bstatic with the LINK_SEARCH_END_STATIC property: http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:LINK_SEARCH_END_STATIC To ensure a static pthread library is chosen, refer to it by name (libpthread.a) or full path. -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
