[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    [CMake] linking with libstdc++ statically
From:       "victor.zverovich () gmail ! com" <victor ! zverovich () gmail ! com>
Date:       2014-08-27 21:19:43
Message-ID: CANawtxZfBJD_T5rrK4m655cbpBjKY8dg96dr1VYR5xBtyuo1OQ () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

I am trying to link an application with libstdc++ statically on Linux and
OS X. The first attempt was to add -static-libstdc++ to
CMAKE_EXE_LINKER_FLAGS:

  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")

This works on Linux with GCC, but Clang gives the following error on OS X:

  clang: warning: argument unused during compilation: '-static-libstdc++'

Another way that I found is to find the location of static libstdc++
library in the directories given by CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES and
modify
CMAKE_CXX_IMPLICIT_LINK_LIBRARIES.

Is there a better way to link with libstdc++ statically in CMake?

Thanks,
Victor

[Attachment #5 (text/html)]

<div dir="ltr">Hello,<div><br></div><div>I am trying to link an application with \
libstdc++ statically on Linux and OS X. The first attempt was to add \
-static-libstdc++ to CMAKE_EXE_LINKER_FLAGS:</div><div><br></div><div>   \
set(CMAKE_EXE_LINKER_FLAGS &quot;${CMAKE_EXE_LINKER_FLAGS} \
-static-libstdc++&quot;)<br>

</div><div><br></div><div>This works on Linux with GCC, but Clang gives the following \
error on OS X:</div><div><br></div><div>    clang: warning: argument unused during \
compilation: &#39;-static-libstdc++&#39;</div><div><br>

</div><div>Another way that I found is to find the location of static libstdc++ \
library in the directories given by CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES  and \
modify</div><div>CMAKE_CXX_IMPLICIT_LINK_LIBRARIES.</div><div><br>

</div><div>Is there a better way to link with libstdc++ statically in \
CMake?</div><div><br></div><div>Thanks,</div><div>Victor</div></div>



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic