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

Robert Goulet Robert.Goulet at autodesk.com
Tue Jan 13 11:08:47 EST 2015


Problem with that is that we are using generator expressions in the library path names. That won't work when trying to set CMAKE_EXE_LINKER_FLAGS if I'm not mistaken.

-----Original Message-----
From: Dmitry Polyanitsa [mailto:dpolyanitsa at nvidia.com] 
Sent: Tuesday, January 13, 2015 11:01 AM
To: Robert Goulet; Brad King
Cc: Justin Borodinsky; cmake-developers at cmake.org
Subject: RE: [cmake-developers] target_link_libraries and --start-group/--end-group ?

Ah, in that case I'm afraid it won't work since we've added the parentheses syntax in 3.0r4.

The only other option I can think of is using the Linker -> Command Line -> Additional Options to manually add all the dependencies and leave the Linker -> Input -> Additional Dependencies empty. These additional options are passed to the linker unchanged and lots of people have been using them to define linker groups before we've introduced the official syntax for that. I'm not sure how you can write to that property from CMakeLists.txt, however.

Brad, can we do that in CMake? Our additional options are compatible with VC++ ones in terms of the metadata name, i.e. it's Link.AdditionalOptions.

-Dmitry

-----Original Message-----
From: Robert Goulet [mailto:Robert.Goulet at autodesk.com]
Sent: Tuesday, January 13, 2015 6:52 PM
To: Dmitry Polyanitsa; Brad King
Cc: Justin Borodinsky; cmake-developers at cmake.org
Subject: RE: [cmake-developers] target_link_libraries and --start-group/--end-group ?

Using NVidia NSight Tegra 3.0r3. Upgrading to 3.0r4 is not an option right now because it would require all our users to use and nightly build of CMake and we want to stick with official releases.

-----Original Message-----
From: Dmitry Polyanitsa [mailto:dpolyanitsa at nvidia.com]
Sent: Tuesday, January 13, 2015 10:48 AM
To: Robert Goulet; Brad King
Cc: Justin Borodinsky; cmake-developers at cmake.org
Subject: RE: [cmake-developers] target_link_libraries and --start-group/--end-group ?

Robert,

What Nsight Tegra version are you using? The AdditionalDependencies string you've described should be correctly parsed as libraries list with a group in the latest Nsight Tegra release.

Unfortunately, the existence of a declarative-style platform files workaround is unlikely - we do most of the processing in the build tasks DLL, which is written in C#, so you cannot easily alter things there.

-Dmitry

-----Original Message-----
From: Robert Goulet [mailto:Robert.Goulet at autodesk.com]
Sent: Tuesday, January 13, 2015 6:37 PM
To: Brad King
Cc: Dmitry Polyanitsa; Justin Borodinsky; cmake-developers at cmake.org
Subject: RE: [cmake-developers] target_link_libraries and --start-group/--end-group ?

Hi all,

Dmitry suggestion didn't work. It outputs the following in the .vcxproj file:

<AdditionalDependencies>c;m;dl;log;android;EGL;GLESv2;OpenSLES;(;foo;bar;)</AdditionalDependencies>

...and Nsight Tegra interpreted it like this (clang compiler):

-l"c" -l"m" -l"dl" -l"log" -l"android" -l"EGL" -l"GLESv2" -l"OpenSLES" -l"(" -l"foo" -l"bar" -l")"

...which obviously generated a link error (cannot find library '(' and ')').

Using Brad's method of link multiplicity is too much work because we make use of packages and heavy generator expressions, making it a lot more difficult and much less elegant.

Dmitry, is there a work-around I could temporarily implement in the VS files until you issue a new version of Nsight Tegra? i.e. the files found under "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Tegra-Android" ?

Thanks.

-----Original Message-----
From: Brad King [mailto:brad.king at kitware.com]
Sent: Tuesday, January 13, 2015 9:11 AM
To: Robert Goulet
Cc: Dmitry Polyanitsa; Justin Borodinsky; cmake-developers at cmake.org
Subject: Re: [cmake-developers] target_link_libraries and --start-group/--end-group ?

On 1/13/2015 6:19 AM, Dmitry Polyanitsa wrote:
> you could try using parentheses instead of 
> -Wl,--start-group/-Wl,--end-group
[snip]
> it should serve as a workaround while we fix the prefix addition to 
> the -Wl flags in Nsight Tegra.

Thanks, Dmitry.

Robert, the linker group flags are platform-specific so the approach CMake offers for doing this in general is the "link multiplicity"
approach Robert Maynard mentioned earlier in this thread:

On 1/6/2015 3:50 PM, Robert Goulet wrote:
> But it doesn't seems to work when building for NVidia NSight Android 
> platform using Visual Studio IDE.

With IMPORTED_LINK_INTERFACE_MULTIPLICITY and circular settings for INTERFACE_LINK_LIBRARIES the libraries should show up repeated in the .vcxproj file.

-Brad

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


More information about the cmake-developers mailing list