diff options
author | Sebastien Barre <sebastien.barre@kitware.com> | 2001-10-23 21:49:13 (GMT) |
---|---|---|
committer | Sebastien Barre <sebastien.barre@kitware.com> | 2001-10-23 21:49:13 (GMT) |
commit | cc731ac54853118438bee0f9f5d9df2287ec615b (patch) | |
tree | 67873db2bdb02a82893100afa0312486f13b4de1 /Source/cmGetFilenameComponentCommand.cxx | |
parent | 10c54eb2a509e7d8e634c6c38b67f725093413cd (diff) | |
download | CMake-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.cxx | 24 |
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; } |