summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-01-11 18:00:29 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-01-11 18:00:29 (GMT)
commitee886fbbdba89aa0b850ee14d75c9f87211e3325 (patch)
treebf2118d9b4ee31c235bc0112ca5fbcf8c3164af8 /Source/cmLocalGenerator.cxx
parent510f578f8b53858fbb541c4e7e4731de9bfbd483 (diff)
downloadCMake-ee886fbbdba89aa0b850ee14d75c9f87211e3325.zip
CMake-ee886fbbdba89aa0b850ee14d75c9f87211e3325.tar.gz
CMake-ee886fbbdba89aa0b850ee14d75c9f87211e3325.tar.bz2
ENH: add CMAKE_DEFINE_FLAG_(LANG) that can replace -D flags with what the compiler actually uses
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx40
1 files changed, 39 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index f91ed10..e7d78cd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1182,7 +1182,10 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
{
flags[flags.size()-1] = ' ';
}
- flags += this->Makefile->GetDefineFlags();
+ std::string defineFlags = this->Makefile->GetDefineFlags();
+ std::cout << defineFlags << "\n";
+ this->FixDefineFlags(defineFlags, lang);
+ flags += defineFlags;
this->LanguageToIncludeFlags[lang] = flags;
// Use this temorary variable for the return value to work-around a
@@ -1192,6 +1195,41 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang)
}
//----------------------------------------------------------------------------
+void cmLocalGenerator::FixDefineFlags(std::string& flags,
+ const char* lang)
+{
+ std::string defineFlagVar = "CMAKE_DEFINE_FLAG_";
+ defineFlagVar += lang;
+ std::string defineFlag =
+ this->Makefile->GetSafeDefinition(defineFlagVar.c_str());
+ if(defineFlag.size() == 0)
+ {
+ return;
+ }
+ std::vector<std::string> args;
+ cmSystemTools::ParseWindowsCommandLine(flags.c_str(), args);
+ std::string fixedFlags;
+ const char* sep = 0;
+ for(std::vector<std::string>::iterator i = args.begin();
+ i != args.end(); ++i)
+ {
+ if(sep)
+ {
+ fixedFlags += sep;
+ }
+ else
+ {
+ sep = " ";
+ }
+ cmSystemTools::ReplaceString(*i, "-D", defineFlag.c_str());
+ fixedFlags += *i;
+ }
+ flags = fixedFlags;
+}
+
+
+
+//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
bool filter_system_dirs)
{