[cmake-developers] target_link_libraries and --start-group/--end-group ?

Justin Borodinsky justin.borodinsky at gmail.com
Thu Jan 8 22:18:19 EST 2015


I had a similar problem, and I found that passing the extra flags, along
with the libraries, to target_link_libraries directly worked.

On Tue, Jan 6, 2015 at 3:50 PM, Robert Goulet <Robert.Goulet at autodesk.com>
wrote:

>  Thanks Robert,
>
>
>
> But it doesn’t seems to work when building for NVidia NSight Android
> platform using Visual Studio IDE. Is there a way to add custom flags before
> and after the flags set by target_link_libraries? I tried
> CMAKE_LINK_EXE_FLAGS but it doesn’t work. Thanks!
>
>
>
> *From:* Robert Maynard [mailto:robert.maynard at kitware.com]
> *Sent:* Monday, January 5, 2015 4:22 PM
> *To:* Robert Goulet
> *Cc:* cmake-developers at cmake.org
> *Subject:* Re: [cmake-developers] target_link_libraries and
> --start-group/--end-group ?
>
>
>
> I believe what you want to do is bring the libraries in as imported
> targets and set the target property IMPORTED_LINK_INTERFACE_MULTIPLICITY (
> http://www.cmake.org/cmake/help/v3.0/prop_tgt/IMPORTED_LINK_INTERFACE_MULTIPLICITY.html
> ).
>
>
>
> By default the value should be 2 which means that we will list all static
> libraries twice, but you might need to increase the value.
>
>
>
> I would also read the resolution of bug 14463 (
> http://public.kitware.com/Bug/view.php?id=14463) for a quick explanation
> of how the target_link_libraries order determines the static link ordering.
>
>
>
>
>
> On Mon, Jan 5, 2015 at 2:09 PM, Robert Goulet <Robert.Goulet at autodesk.com>
> wrote:
>
>  Hi,
>
>
>
> My project needs to link with an external library which actually consist
> of a set of libraries. Adding these libs using target_link_libraries should
> be working just fine but unfortunately these libs have a bunch of circular
> dependencies, so it fails. In the makefile, we link with these libs using
> this syntax:
>
>
>
> -Wl,--start-group …libs… -Wl,--end-group
>
>
>
> …so that the linker is able to correctly find all symbols. What’s the
> proper way to deal with this using CMake? I tried to add the group flags to
> target_link_libraries but it does not work. Thanks!
>
>
>
>
>
>
>
> *Robert Goulet*
>
> Senior Software Developer
>
> Games Solutions Group
>
> Autodesk Media & Entertainment
>
>
>
> *MAIN* +1 514 393 1616 <%2B1%20514%20393%201616>
>
> *DIRECT* +1 514 954 3911 <%2B1%20514%20954%203911>
>
> *MOBILE* +1 438 397 4075
>
>
>
> *Autodesk, Inc.*
>
> 10 Rue Duke
>
> Montreal, QC, H3C 2L7
>
> www.autodesk.com
>
>
>
> [image: Description: Email_Signature_Logobar]
>
>
>
>
> --
>
> 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-developers
>
>
>
> --
>
> 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-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150108/87e5925c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 14277 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150108/87e5925c/attachment-0001.jpg>


More information about the cmake-developers mailing list