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

Dmitry Polyanitsa dpolyanitsa at nvidia.com
Tue Jan 13 06:19:11 EST 2015


Hi Brad, Robert,

Here's the algorithm in short: we split the string by the semicolon and then merge it again, processing each entry as follows. If it contains a slash (forward or backward) or ends with a .so or .a, we consider it to be a fully specified path and don’t add the "-l" prefix. Otherwise, we add it. We also do some additional processing to handle parentheses (we use them to denote start/end of the groups), but it should be orthogonal to the addition of the prefix.

Speaking of which, you could try using parentheses instead of -Wl,--start-group/-Wl,--end-group to define a linker group in the CMakeLists.txt file. The following worked for me (note the escaping):
target_link_libraries(twolib-second twolib-first \( c m gcc log \))

This won't be compatible with other generators I presume, but at least it should serve as a workaround while we fix the prefix addition to the -Wl flags in Nsight Tegra.

-Dmitry

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

On 1/12/2015 12:39 PM, Robert Goulet wrote:
> the generated line in the .vcxproj file looks correct :
> 
> <AdditionalDependencies>android;dl;EGL;GLESv3;OpenSLES;-Wl,--start-gro
> up;libfoo.a;libbar.a;-Wl,--end-group</AdditionalDependencies>
> 
> So now I am guessing the problem is in the glue that adds support of Android to the VS IDE?
> Where is the code that translate a link library into the command line, such as "libfoo.a" to "-lfoo"?

That is in the Nsight Tegra implementation AFAIK.  Here is a related change already in 3.1.0:

 VS: Fix Tegra-Android platform linking of libraries by name
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=178f56a5

Dmitry, how does Nsight Tegra transform these flags?

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