[cmake-commits] hoffman committed cmLocalGenerator.cxx 1.247 1.248
cmLocalGenerator.h 1.92 1.93
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Jan 11 13:00:31 EST 2008
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv3868
Modified Files:
cmLocalGenerator.cxx cmLocalGenerator.h
Log Message:
ENH: add CMAKE_DEFINE_FLAG_(LANG) that can replace -D flags with what the compiler actually uses
Index: cmLocalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.cxx,v
retrieving revision 1.247
retrieving revision 1.248
diff -u -d -r1.247 -r1.248
--- cmLocalGenerator.cxx 7 Jan 2008 21:12:37 -0000 1.247
+++ cmLocalGenerator.cxx 11 Jan 2008 18:00:29 -0000 1.248
@@ -1182,7 +1182,10 @@
{
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 @@
}
//----------------------------------------------------------------------------
+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)
{
Index: cmLocalGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalGenerator.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- cmLocalGenerator.h 7 Jan 2008 21:12:37 -0000 1.92
+++ cmLocalGenerator.h 11 Jan 2008 18:00:29 -0000 1.93
@@ -270,7 +270,7 @@
unsigned int minor,
unsigned int patch = 0xFFu);
protected:
-
+ void FixDefineFlags(std::string& defineFlags, const char* lang);
/** Construct a comment for a custom command. */
std::string ConstructComment(const cmCustomCommand& cc,
const char* default_comment = "");
More information about the Cmake-commits
mailing list