[CMake] statically linking libstdc++ problem.

christopher at baus.net christopher at baus.net
Thu Jun 2 02:00:17 EDT 2005


>
>> 2.) Create a directory that contains a symlink to the static version of
>> the library and then use the LINK_DIRECTORIES command to add it to the
>> link path.  Then the linker will find the static version and use it.
>
> I got this working except I need to pass -static-libgcc to the linker.
> How should I do that?  I hacked the makefile by hand, to get a static
> libgcc.
>

Ok, here are the rules I am using to get it working:

IF( ${CMAKE_COMPILER_IS_GNUCXX} )
  ADD_DEFINITIONS(-static-libgcc)
  SET(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE}
-static-libgcc")
ENDIF( ${CMAKE_COMPILER_IS_GNUCXX} )

Is this the right way to do this?



More information about the CMake mailing list