[cmake-developers] Importing platform SDK libraries without a full path
Brad King
brad.king at kitware.com
Wed May 27 09:15:07 EDT 2015
On 05/26/2015 05:14 PM, Stephen Kelly wrote:
>> This would amount to a separate task of making IMPORTED_LOCATION
>> an error on an INTERFACE library.
>
> Actually this is already an error case because IMPORTED_LOCATION is not
> whitelisted, so nothing more to do.
Great.
> + " property value\n " + value + "\nmay not start in '-'.");
>
> should be "may not start with ..."
Fixed.
> It seems that the meaning of INTERFACE libraries is being overloaded
> with the opposite of their meaning.
The meaning of INTERFACE is that it specifies usage requirements
without itself building anything. Specifying a library name to
be placed on the link line is a usage requirement. The target
does not build the named library. I've updated the documentation
to use better wording for this:
An interface library builds no library file itself but does specify
usage requirements for its consumers. The ``IMPORTED_LIBNAME``
property may be set to specify a single library name to be placed
on the link line in place of the interface library target name as
a requirement for using the interface.
> How about allowing the IMPORTED_LIBNAME for only 'UNKNOWN IMPORTED'
> libraries instead.
We already allow $<TARGET_FILE:...> for UNKNOWN IMPORTED libraries
so they need an IMPORTED_LOCATION with a full path like any other.
> Also the changes regarding MAP_IMPORTED_CONFIG for INTERFACE libraries can
> be implemented separately if they make sense (I don't know what's motivating
> them) instead having them as a side effect of the branch as it is currently.
They are needed to select the proper IMPORTED_LIBNAME_<CONFIG>
possibly mapped from the consuming project's configuration.
The fact that this could be done with just the hunk
- std::string const locPropBase = "IMPORTED_LOCATION";
+ std::string const locPropBase =
+ this->GetType() == INTERFACE_LIBRARY?
+ "IMPORTED_LIBNAME" : "IMPORTED_LOCATION";
shows how purely IMPORTED_LIBNAME corresponds to IMPORTED_LOCATION.
The commit with the above revisions is here:
Allow imported INTERFACE libraries to specify a link library name
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=91b38b03
Thanks,
-Brad
More information about the cmake-developers
mailing list