summaryrefslogtreecommitdiffstats
path: root/Source/cmGetFilenameComponentCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGetFilenameComponentCommand.cxx')
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 390cef8..cfefdb9 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -50,6 +50,17 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
return false;
}
+ // Check and see if the value has been stored in the cache
+ // already, if so use that value
+ if(args.size() == 4 && args[3] == "CACHE")
+ {
+ const char* cacheValue = m_Makefile->GetDefinition(args[0].c_str());
+ if(cacheValue && strcmp(cacheValue, "NOTFOUND"))
+ {
+ return true;
+ }
+ }
+
std::string result;
std::string filename = args[1];
m_Makefile->ExpandVariablesInString(filename);
@@ -77,7 +88,18 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
return false;
}
- m_Makefile->AddDefinition(args[0].c_str(), result.c_str());
+ if(args.size() == 4 && args[3] == "CACHE")
+ {
+ m_Makefile->AddCacheDefinition(args[0].c_str(),
+ result.c_str(),
+ "",
+ args[2] == "PATH" ? cmCacheManager::FILEPATH
+ : cmCacheManager::STRING);
+ }
+ else
+ {
+ m_Makefile->AddDefinition(args[0].c_str(), result.c_str());
+ }
return true;
}