[CMake] How to static link with MinGW's libgcc and libstdc++

Loaden loaden at gmail.com
Tue Sep 11 10:21:38 EDT 2012


Hi, list!
I wan't use cmake + MSVC2010SP1 via wine on Linux (Ubuntu 12.04).
In first step, I need compile CMake self on Linux, so the cross compilation
is should to go.
I edit the CMake 2.8.9's main CMakeLists.txt, added these line:

if (MINGW)
>     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
>     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc
> -static-libstdc++")
>     set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS
> "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static-libgcc -s")
>     set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS
> "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static-libgcc -static-libstdc++
> -s")
> endif()
>

and it works.
But I thought it possible not correct.
Because it's more complex.

Does there exist a simply way to solve my problem?
Thanks!
-- 
Best Regards
Yuchen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120911/d5789440/attachment.htm>


More information about the CMake mailing list