summaryrefslogtreecommitdiffstats
path: root/Source/cmGetFilenameComponentCommand.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-11-19 23:17:17 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-11-19 23:17:17 (GMT)
commit5a75e03037b946abe56563fa1b568496f309ef5d (patch)
tree23f08815b01fea1e7216fac52a293ed347f73ad2 /Source/cmGetFilenameComponentCommand.cxx
parent939035ad91aff5de5a1b514176cd2765a1b9a728 (diff)
downloadCMake-5a75e03037b946abe56563fa1b568496f309ef5d.zip
CMake-5a75e03037b946abe56563fa1b568496f309ef5d.tar.gz
CMake-5a75e03037b946abe56563fa1b568496f309ef5d.tar.bz2
allow flags to be in the CC and CXX environment variables
Diffstat (limited to 'Source/cmGetFilenameComponentCommand.cxx')
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx30
1 files changed, 29 insertions, 1 deletions
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 55bd6a4..f277627 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -39,7 +39,8 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
std::string result;
std::string filename = args[1];
-
+ std::string storeArgs;
+ std::string programArgs;
if (args[2] == "PATH")
{
result = cmSystemTools::GetFilenamePath(filename);
@@ -48,6 +49,21 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
{
result = cmSystemTools::GetFilenameName(filename);
}
+ else if (args[2] == "PROGRAM")
+ {
+ for(int i=2; i < args.size(); ++i)
+ {
+ if(args[i] == "PROGRAM_ARGS")
+ {
+ i++;
+ if(i < args.size())
+ {
+ storeArgs = args[i];
+ }
+ }
+ }
+ cmSystemTools::SplitProgramFromArgs(filename.c_str(), result, programArgs);
+ }
else if (args[2] == "EXT")
{
result = cmSystemTools::GetFilenameExtension(filename);
@@ -65,6 +81,14 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
if(args.size() == 4 && args[3] == "CACHE")
{
+ if(programArgs.size() && storeArgs.size())
+ {
+ m_Makefile->AddCacheDefinition(storeArgs.c_str(),
+ programArgs.c_str(),
+ "",
+ args[2] == "PATH" ? cmCacheManager::FILEPATH
+ : cmCacheManager::STRING);
+ }
m_Makefile->AddCacheDefinition(args[0].c_str(),
result.c_str(),
"",
@@ -73,6 +97,10 @@ bool cmGetFilenameComponentCommand::InitialPass(std::vector<std::string> const&
}
else
{
+ if(programArgs.size() && storeArgs.size())
+ {
+ m_Makefile->AddDefinition(storeArgs.c_str(), programArgs.c_str());
+ }
m_Makefile->AddDefinition(args[0].c_str(), result.c_str());
}