summaryrefslogtreecommitdiffstats
path: root/Source/cmSourceFile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-01-30 16:21:54 (GMT)
committerBrad King <brad.king@kitware.com>2008-01-30 16:21:54 (GMT)
commitd5db5a275a1f6839d70ca0c76dfedb2e63705b58 (patch)
treed11704d58d75c7ed0e141caa2ba12c6ffde8e815 /Source/cmSourceFile.cxx
parentc4093afc52967c987f0cd2947949899642db977b (diff)
downloadCMake-d5db5a275a1f6839d70ca0c76dfedb2e63705b58.zip
CMake-d5db5a275a1f6839d70ca0c76dfedb2e63705b58.tar.gz
CMake-d5db5a275a1f6839d70ca0c76dfedb2e63705b58.tar.bz2
BUG: Add cmSourceFile::GetPropertyForUser to centralize the LOCATION property hack. This fixes the LOCATION property when retrieved via the get_property command.
Diffstat (limited to 'Source/cmSourceFile.cxx')
-rw-r--r--Source/cmSourceFile.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 48f975d..da2664f 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -281,6 +281,33 @@ void cmSourceFile::AppendProperty(const char* prop, const char* value)
}
//----------------------------------------------------------------------------
+const char* cmSourceFile::GetPropertyForUser(const char *prop)
+{
+ // This method is a consequence of design history and backwards
+ // compatibility. GetProperty is (and should be) a const method.
+ // Computed properties should not be stored back in the property map
+ // but instead reference information already known. If they need to
+ // cache information in a mutable ivar to provide the return string
+ // safely then so be it.
+ //
+ // The LOCATION property is particularly problematic. The CMake
+ // language has very loose restrictions on the names that will match
+ // a given source file (for historical reasons). Implementing
+ // lookups correctly with such loose naming requires the
+ // cmSourceFileLocation class to commit to a particular full path to
+ // the source file as late as possible. If the users requests the
+ // LOCATION property we must commit now.
+ if(strcmp(prop, "LOCATION") == 0)
+ {
+ // Commit to a location.
+ this->GetFullPath();
+ }
+
+ // Perform the normal property lookup.
+ return this->GetProperty(prop);
+}
+
+//----------------------------------------------------------------------------
const char* cmSourceFile::GetProperty(const char* prop) const
{
// Check for computed properties.