diff options
author | Brad King <brad.king@kitware.com> | 2009-01-05 14:53:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-01-05 14:53:14 (GMT) |
commit | d7ddcc214f108131b1e301af96cd6e1df4ce0070 (patch) | |
tree | 5e1969f50969a2881a3c58a6ca6273b404e17dad /Source/cmTarget.cxx | |
parent | 57dd0d95e9b3217cfb2a7836fe14442db8df96a3 (diff) | |
download | CMake-d7ddcc214f108131b1e301af96cd6e1df4ce0070.zip CMake-d7ddcc214f108131b1e301af96cd6e1df4ce0070.tar.gz CMake-d7ddcc214f108131b1e301af96cd6e1df4ce0070.tar.bz2 |
ENH: Enable LOCATION property for imported targets
Previously we left the LOCATION property undefined for imported targets
since it should no longer be used for non-imported targets. However, in
the case we do not know the name of an available imported configuration,
it is more readable to get the LOCATION property than LOCATION_<CONFIG>
for a bogus configuration <CONFIG>. This enables LOCATION for imported
targets and returns an unspecified available imported configuration.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 0702be3..0f9366e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -385,22 +385,34 @@ void cmTarget::DefineProperties(cmake *cm) cm->DefineProperty ("LOCATION", cmProperty::TARGET, - "Deprecated. Use LOCATION_<CONFIG> or avoid altogether.", - "This property is provided for compatibility with CMake 2.4 and below. " + "Read-only location of a target on disk.", + "For an imported target, this read-only property returns the value of " + "the LOCATION_<CONFIG> property for an unspecified configuration " + "<CONFIG> provided by the target.\n" + "For a non-imported target, this property is provided for compatibility " + "with CMake 2.4 and below. " "It was meant to get the location of an executable target's output file " "for use in add_custom_command. " + "The path may contain a build-system-specific portion that " + "is replaced at build time with the configuration getting built " + "(such as \"$(ConfigurationName)\" in VS). " "In CMake 2.6 and above add_custom_command automatically recognizes a " "target name in its COMMAND and DEPENDS options and computes the " - "target location. Therefore this property need not be used. " - "This property is not defined for IMPORTED targets because they " - "were not available in CMake 2.4 or below anyway."); + "target location. " + "Therefore this property is not needed for creating custom commands."); cm->DefineProperty ("LOCATION_<CONFIG>", cmProperty::TARGET, "Read-only property providing a target location on disk.", "A read-only property that indicates where a target's main file is " "located on disk for the configuration <CONFIG>. " - "The property is defined only for library and executable targets."); + "The property is defined only for library and executable targets. " + "An imported target may provide a set of configurations different " + "from that of the importing project. " + "By default CMake looks for an exact-match but otherwise uses an " + "arbitrary available configuration. " + "Use the MAP_IMPORTED_CONFIG_<CONFIG> property to map imported " + "configurations explicitly."); cm->DefineProperty ("LINK_INTERFACE_LIBRARIES", cmProperty::TARGET, @@ -2038,13 +2050,17 @@ const char *cmTarget::GetProperty(const char* prop, this->GetType() == cmTarget::MODULE_LIBRARY || this->GetType() == cmTarget::UNKNOWN_LIBRARY) { - if(!this->IsImported() && strcmp(prop,"LOCATION") == 0) + if(strcmp(prop,"LOCATION") == 0) { - // Set the LOCATION property of the target. Note that this + // Set the LOCATION property of the target. + // + // For an imported target this is the location of an arbitrary + // available configuration. + // + // For a non-imported target this is deprecated because it // cannot take into account the per-configuration name of the // target because the configuration type may not be known at - // CMake time. It is now deprecated as described in the - // documentation. + // CMake time. this->SetProperty("LOCATION", this->GetLocation(0)); } |