[cmake-developers] RPATH info missing when using a genex (Was: Recommended use of imported targets...)

Stephen Kelly steveire at gmail.com
Thu Feb 28 12:31:32 EST 2013


Alexander Neundorf wrote:

> On Thursday 28 February 2013, Stephen Kelly wrote:
>> Brad King wrote:
>> > On 02/27/2013 04:37 PM, Alexander Neundorf wrote:
>> >> 1) we should continue to recommend to use the variables (which will
>> >> now be set to the name of the target). In case of typos, this will
>> >> lead to an empty variable (as it did before with Find-modules), and
>> >> undefined references when linking. This is at least no regression.
>> >> Also, it shields users somewhat from potential renaming of the
>> >> imported targets.
>> > 
>> > This is up to individual projects based on their own requirements.
>> > Some interface may be more stable than others.  I do not think any
>> > general recommendation can be made without lots of contingencies.
>> > 
>> >> safe_target_link_libraries(hello TARGET:foox
>> >> 
>> >>                                  FILE:/opt/lib/libbar.a
>> >>                                  LIBRARY:png)
>> > 
>> > Sure, it is possible to make interfaces typo-resistant by adding lots
>> > of syntax.  Part of the simplicity tll() is that it has little syntax.
>> > 
>> > Note that FILE: and LIBRARY: do not need to be distinguished from
>> > one another because files always have paths (/) and library names
>> > never do.  For TARGET: we already have $<TARGET_NAME:foox>, which
>> > IIUC can be used in tll already (Steve?).
>> 
>> That works, but it doesn't check anything. Checking is only done at
>> export- time (though it could also check for existence at generate time).
> 
> So if I would do (I don't plan to)
> 
> target_link_libraries(foo <TARGET_NAME:png> )
> 
> it would not check that there is a target named "png" ?
> 

You missed a $, but yes, $<TARGET_NAME:png> will only check at export time 
that the png target exists (currently). 

Thanks,

Steve.





More information about the cmake-developers mailing list