summaryrefslogtreecommitdiffstats
path: root/Source/cmGetFilenameComponentCommand.cxx
diff options
context:
space:
mode:
authorSebastien Barre <sebastien.barre@kitware.com>2001-10-23 21:49:13 (GMT)
committerSebastien Barre <sebastien.barre@kitware.com>2001-10-23 21:49:13 (GMT)
commitcc731ac54853118438bee0f9f5d9df2287ec615b (patch)
tree67873db2bdb02a82893100afa0312486f13b4de1 /Source/cmGetFilenameComponentCommand.cxx
parent10c54eb2a509e7d8e634c6c38b67f725093413cd (diff)
downloadCMake-cc731ac54853118438bee0f9f5d9df2287ec615b.zip
CMake-cc731ac54853118438bee0f9f5d9df2287ec615b.tar.gz
CMake-cc731ac54853118438bee0f9f5d9df2287ec615b.tar.bz2
The result of this utility command can now be optionally added to the cache
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;
}