[cmake-developers] Documented property IMPORTED_LOCATION does not exist

Alan W. Irwin irwin at beluga.phys.uvic.ca
Wed Jan 25 15:12:43 EST 2012


On 2012-01-25 08:14-0500 Brad King wrote:

> On 1/25/2012 1:50 AM, Michael Wild wrote:
>> So, to fix your code, use IMPORTED_LOCATION_NOCONFIG.
>
> Actually just use "LOCATION" or "LOCATION_${CONFIG}" for some CONFIG:
>
> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:LOCATION
> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:LOCATION_CONFIG
>
> They will tell you where to find the target file for any target,
> including imported targets.  The IMPORTED_... properties are really
> meant for *setting* to tell CMake something, not for *getting*
> information from CMake.

That important distinction between IMPORTED_LOCATION and LOCATION
needs clarification in the documentation so even experienced CMake
users like me are not mislead.

For example, under PROPERTIES ON TARGETS, the IMPORTED_LOCATION
documentation uses the phrase "this is" a lot implying the property
exists (i.e., has been reliably set) for any given imported target.

Michael's original response to me said he used IMPORTED_LOCATION all
the time with no issues.  So he apparently configures his software
builds in some way (is that because you always set CMAKE_BUILD_TYPE,
Michael?) to actually make the exported modules contain
IMPORTED_LOCATION, while for PLplot I just build it with no specified
CMAKE_BUILD_TYPE so only IMPORTED_LOCATION_NOCONFIG (but not
IMPORTED_LOCATION) is set in the exported modules.

Is that the real issue here?  Should exporting a target automatically
set both IMPORTED_LOCATION_NOCONFIG _and_ IMPORTED_LOCATION for all
cases (e.g., when you haven't set CMAKE_BUILD_TYPE as in my particular
PLplot build)?

Of course, if I had read further in the documentation to LOCATION, it
is made clear there that is the READ-ONLY one that should be used for
most generality.

But I didn't read further since the IMPORTED_LOCATION section implied
that property would be set reliably for imported targets, and
certainly Michael's original response seemed to confirm that as well,
i.e., his experience seemed to be consistent with that documentation.

So it appear to me the choices are to set IMPORTED_LOCATION in export
modules reliably regardless of how CMAKE_BUILD_TYPE is set (or not
set) or to change the documentation of IMPORTED_LOCATION to indicate
it is not always reliably set for imported targets and urge the reader
to use LOCATION instead.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________



More information about the cmake-developers mailing list