[CMake] Problems building statically linked executable

Marcel Loose loose at astron.nl
Mon May 11 07:52:50 EDT 2009


Reply to self.

On Mon, 2009-05-11 at 10:26 +0200, Marcel Loose wrote:

--- 8< --- 8< --- 8< --- 8< --- 8< --- 8< --- 8< ---
> In the mean time, is there a way to get rid of these spurious
> -Wl,-Bdynamic and -Wl,-Bstatic flags?

OK, I'll use this dirty hack for the time being when creating statically
linked executables. If anyone knows a cleaner way to do this, please let
me know.

    set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)       # remove -Wl,-Bdynamic
    set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
    set(CMAKE_SHARED_LIBRARY_C_FLAGS)         # remove -fPIC
    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS)
    set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)    # remove -rdynamic
    set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)

Marcel Loose.




More information about the CMake mailing list