[CMake] setting LINKER_LANGUAGE still adds -lstdc++

James Bigler jamesbigler at gmail.com
Tue Oct 9 03:05:28 EDT 2012


On Tue, Oct 9, 2012 at 12:07 AM, Eric Noulard <eric.noulard at gmail.com>wrote:

> 2012/10/9 James Bigler <jamesbigler at gmail.com>:
> > In my project I need to manually link against a special version of
> > libstdc++, so I manually set the target link language to C and then add
> my
> > special library to the link line.  On Linux this seems to work just fine,
> > but on OSX it still add -lstdc++ to the link like.  Here's my cmake code:
>
> This doesn't seem to work on Linux either on my side, stdc++ gets in the
> link
> line as well:
>
> /usr/bin/cc  -fPIC    -shared -Wl,-soname,liba.so -o liba.so
> CMakeFiles/a.dir/a.cpp.o -lstdc++ -lm
>
> Did you try to fiddle with CMAKE_CXX_IMPLICIT_LINK_LIBRARIES ?
>
> --
> Erk
> Le gouvernement représentatif n'est pas la démocratie --
> http://www.le-message.org
>

I can manually remove the library thusly:

   list(REMOVE_ITEM CMAKE_CXX_IMPLICIT_LINK_LIBRARIES stdc++)

This "works around" the issue, but it is rather ugly (directory scoped
rather than target scoped) and non-intuitive (there's no documentation for
this flag - I had to dig it out of emails and source).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121009/a7d39ebd/attachment.htm>


More information about the CMake mailing list