RosBE/Patches/CMake-jgardou-changes-against-2.8.5.patch
Colin Finck 567afc4e86 Commit the patch containing Jérôme's CMake improvements.
Should be applied against CMake 2.8.5 sources.

svn path=/trunk/RosBE/; revision=1317
2011-09-11 22:27:10 +00:00

179 lines
6.3 KiB
Diff

commit ac1ac0fcf87dbff595400cef9e1f8ae213c33a8a
Author: Jérôme Gardou <jerome.gardou@laposte.net>
Date: Tue Jun 28 19:02:12 2011 +0200
Implements raw replacement for IMPLICIT_DEPENDS_INCLUDE_TRANSFORM target property
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index d0df8f0..714e4b7 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -1796,6 +1796,7 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
}
else
{
+ cmSystemTools::ConvertToUnixSlashes(includeFlags);
this->LocalGenerator->AppendFlags(flags, includeFlags.c_str());
}
}
diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx
index 2f558dc..a9e7798 100644
--- a/Source/cmGlobalMinGWMakefileGenerator.cxx
+++ b/Source/cmGlobalMinGWMakefileGenerator.cxx
@@ -66,18 +66,6 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
lg->SetPassMakeflags(false);
lg->SetUnixCD(true);
lg->SetMinGWMake(true);
-
- // mingw32-make has trouble running code like
- //
- // @echo message with spaces
- //
- // If quotes are added
- //
- // @echo "message with spaces"
- //
- // it runs but the quotes are displayed. Instead just use cmake to
- // echo.
- lg->SetNativeEchoCommand("@$(CMAKE_COMMAND) -E echo ", false);
return lg;
}
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 5c2cda1..6ab5c2a 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -68,8 +68,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->ColorMakefile = false;
this->SkipPreprocessedSourceRules = false;
this->SkipAssemblySourceRules = false;
- this->NativeEchoCommand = "@echo ";
- this->NativeEchoWindows = true;
this->MakeCommandEscapeTargetTwice = false;
this->IsMakefileGenerator = true;
this->BorlandMakeCurlyHack = false;
@@ -1235,9 +1233,8 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
if(color_name.empty())
{
// Use the native echo command.
- cmd = this->NativeEchoCommand;
- cmd += this->EscapeForShell(line.c_str(), false,
- this->NativeEchoWindows);
+ cmd = "@echo ";
+ cmd += this->EscapeForShell(line.c_str(), false, true);
}
else
{
diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h
index 9ff6e5e..0994222 100644
--- a/Source/cmLocalUnixMakefileGenerator3.h
+++ b/Source/cmLocalUnixMakefileGenerator3.h
@@ -127,14 +127,6 @@ public:
void SetSilentNoColon(bool v) {this->SilentNoColon = v;}
/**
- * Set the command to use for native make shell echo. The value
- * should include all parts of the command up to the beginning of
- * the message (including a whitespace separator).
- */
- void SetNativeEchoCommand(const char* cmd, bool isWindows)
- { this->NativeEchoCommand = cmd; this->NativeEchoWindows = isWindows; }
-
- /**
* Set the string used to include one makefile into another default
* is include.
*/
@@ -365,8 +357,6 @@ private:
std::string IncludeDirective;
std::string MakeSilentFlag;
std::string ConfigurationName;
- std::string NativeEchoCommand;
- bool NativeEchoWindows;
bool DefineWindowsNULL;
bool UnixCD;
bool PassMakeflags;
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index a76b3af..881dc97 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -511,7 +511,7 @@ void cmDependsC::SetupTransforms()
xform += tri->first;
sep = "|";
}
- xform += ")[ \t]*\\(([^),]*)\\)";
+ xform += ")[ \t]*\\(?([^),]*)\\)?";
this->IncludeRegexTransform.compile(xform.c_str());
// Build a string that encodes all transformation rules and will
@@ -522,8 +522,8 @@ void cmDependsC::SetupTransforms()
{
this->IncludeRegexTransformString += " ";
this->IncludeRegexTransformString += tri->first;
- this->IncludeRegexTransformString += "(%)=";
- this->IncludeRegexTransformString += tri->second;
+ this->IncludeRegexTransformString += tri->second.equals;
+ this->IncludeRegexTransformString += tri->second.value;
}
}
}
@@ -534,13 +534,19 @@ void cmDependsC::ParseTransform(std::string const& xform)
// A transform rule is of the form SOME_MACRO(%)=value-with-%
// We can simply separate with "(%)=".
std::string::size_type pos = xform.find("(%)=");
+ int substringPos = 4;
+ if(pos == xform.npos || pos == 0)
+ {
+ pos = xform.find("=");
+ substringPos = 1;
+ }
if(pos == xform.npos || pos == 0)
{
return;
}
std::string name = xform.substr(0, pos);
- std::string value = xform.substr(pos+4, xform.npos);
- this->TransformRules[name] = value;
+ this->TransformRules[name].equals = xform.substr(pos, substringPos);
+ this->TransformRules[name].value = xform.substr(pos+substringPos, xform.npos);
}
//----------------------------------------------------------------------------
@@ -557,11 +563,16 @@ void cmDependsC::TransformLine(std::string& line)
{
return;
}
+ if(tri->second.equals == "=")
+ {
+ line.replace(line.find(tri->first),tri->first.length(), tri->second.value);
+ return;
+ }
// Construct the transformed line.
std::string newline = this->IncludeRegexTransform.match(1);
std::string arg = this->IncludeRegexTransform.match(4);
- for(const char* c = tri->second.c_str(); *c; ++c)
+ for(const char* c = tri->second.value.c_str(); *c; ++c)
{
if(*c == '%')
{
diff --git a/Source/cmDependsC.h b/Source/cmDependsC.h
index bd9a4b7..13b4ac3 100644
--- a/Source/cmDependsC.h
+++ b/Source/cmDependsC.h
@@ -58,7 +58,13 @@ protected:
// Regex to transform #include lines.
std::string IncludeRegexTransformString;
cmsys::RegularExpression IncludeRegexTransform;
- typedef std::map<cmStdString, cmStdString> TransformRulesType;
+ class TransformRule
+ {
+ public:
+ cmStdString equals;
+ cmStdString value;
+ };
+ typedef std::map<cmStdString, TransformRule> TransformRulesType;
TransformRulesType TransformRules;
void SetupTransforms();
void ParseTransform(std::string const& xform);