[cmake-developers] Importing platform SDK libraries without a full path
Brad King
brad.king at kitware.com
Tue May 26 14:34:26 EDT 2015
On 05/25/2015 08:27 AM, Stephen Kelly wrote:
> it should probably be an error to use TARGET_FILE on an
> INTERFACE target. That doesn't seem to currently be the case.
We already reject that. I've added a test case to show this in
another topic:
Tests: Add case for rejecting $<TARGET_FILE:...> on an INTERFACE library
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=89253992
> Could you add a unit test showing what happens when using that genex with a
> target which has this property?
The changes include a test that it is an error to set the
proposed new property on any target other than an interface
library, and the genex fails as above for interface libraries.
> Can you make it an error to specify both IMPORTED_LOCATION and
> IMPORTED_LINK_ITEM on the same target?
This would amount to a separate task of making IMPORTED_LOCATION
an error on an INTERFACE library. It could be done as a separate
topic that would likely need a policy.
> I think a remaining problem with this is that is disincentivises acheiving
> the larger goals. That is probably a small problem though, as there may be
> other incentives for adding INTERFACE_{LINK,ARCHIVE}_OPTIONS. The other
> incentives appear to be not-as-strong though.
The perfect is the enemy of the good. The larger goals are much harder
to address. This topic fills in a hole in the current capabilities
without opening a larger can of worms.
> Given the 'temporaryness' of this feature, it makes sense to narrow the
> design and use a more-specific name like IMPORTED_SDK_LIBNAME instead.
I chose "IMPORTED_LIBNAME".
> The property should not support an item with a prefix of '-' (ie, CMake should
> unconditionally add the '-l'). Also, it should not be allowed to be a full
> path (should not be allowed to contain a path separator).
[snip]
> So, I don't think IMPORTED_LINK_ITEM should consider this case at all, and
> should be designed with a narrower use case accepting only library names and
> a property name which reflects that.
Yes. Done.
I reverted the FindOpenGL part of the changes for now. The updated
implementation with more restrictions and the IMPORTED_LIBNAME name is:
Allow imported INTERFACE libraries to specify a link library name
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d55f4683
The rest of your response is an excellent writeup that will be a useful
reference for future design work in those areas.
Thanks,
-Brad
More information about the cmake-developers
mailing list