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
-- 

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

Reply via email to