summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx31
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx3
-rw-r--r--Source/cmNinjaTargetGenerator.cxx14
-rw-r--r--Source/cmcldeps.cxx12
-rwxr-xr-xUtilities/Git/pre-commit20
6 files changed, 69 insertions, 13 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 64b7ab7..73f86b8 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 8)
SET(CMake_VERSION_PATCH 8)
-SET(CMake_VERSION_TWEAK 20120718)
+SET(CMake_VERSION_TWEAK 20120724)
#SET(CMake_VERSION_RC 1)
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 07cc75f..912e53e 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -474,10 +474,33 @@ void cmGlobalNinjaGenerator
if(mf->IsOn("CMAKE_COMPILER_IS_MINGW"))
{
UsingMinGW = true;
- std::string rc = cmSystemTools::FindProgram("windres");
- if(rc.empty())
- rc = "windres.exe";;
- mf->AddDefinition("CMAKE_RC_COMPILER", rc.c_str());
+ if(!mf->GetDefinition("CMAKE_RC_COMPILER"))
+ {
+ std::string windres = cmSystemTools::FindProgram("windres");
+ if(windres.empty())
+ {
+ std::string compiler_path;
+ std::string::size_type prefix = std::string::npos;
+ if (mf->GetDefinition("CMAKE_C_COMPILER"))
+ {
+ compiler_path = mf->GetDefinition("CMAKE_C_COMPILER");
+ prefix = compiler_path.rfind("gcc");
+ }
+ else if (mf->GetDefinition("CMAKE_CXX_COMPILER"))
+ {
+ compiler_path = mf->GetDefinition("CMAKE_CXX_COMPILER");
+ prefix = compiler_path.rfind("++");
+ prefix--;
+ }
+ if (prefix != std::string::npos)
+ {
+ windres = compiler_path.substr(0, prefix) + "windres";
+ windres = cmSystemTools::FindProgram(windres.c_str());
+ }
+ }
+ if(!windres.empty())
+ mf->AddDefinition("CMAKE_RC_COMPILER", windres.c_str());
+ }
}
}
this->cmGlobalGenerator::EnableLanguage(language, mf, optional);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index be7739e..5c9bf78 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -495,7 +495,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
int commandLineLengthLimit = 8000 - linkRuleLength;
#elif defined(__linux) || defined(__APPLE__)
// for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
- int commandLineLengthLimit = sysconf(_SC_ARG_MAX) - linkRuleLength - 1000;
+ int commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))
+ - linkRuleLength - 1000;
#else
int commandLineLengthLimit = -1;
#endif
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 4758989..0d02039 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -143,16 +143,18 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source,
this->LocalGenerator->AddCMP0018Flags(flags, this->Target,
language.c_str());
- // TODO: Handle response file.
// Add include directory flags.
{
std::vector<std::string> includes;
this->LocalGenerator->GetIncludeDirectories(includes, this->Target,
language.c_str());
std::string includeFlags =
- this->LocalGenerator->GetIncludeFlags(includes, language.c_str(), false);
+ this->LocalGenerator->GetIncludeFlags(includes, language.c_str(),
+ language == "RC" ? true : false); // full include paths for RC
+ // needed by cmcldeps
if(cmGlobalNinjaGenerator::IsMinGW())
cmSystemTools::ReplaceString(includeFlags, "\\", "/");
+
this->LocalGenerator->AppendFlags(flags, includeFlags.c_str());
}
@@ -467,7 +469,7 @@ cmNinjaTargetGenerator
cmNinjaDeps emptyDeps;
std::string comment;
- const char* language = source->GetLanguage();
+ const std::string language = source->GetLanguage();
std::string rule = this->LanguageCompilerRule(language);
cmNinjaDeps outputs;
@@ -477,7 +479,11 @@ cmNinjaTargetGenerator
this->Objects.push_back(objectFileName);
cmNinjaDeps explicitDeps;
- std::string sourceFileName = this->GetSourceFilePath(source);
+ std::string sourceFileName;
+ if (language == "RC")
+ sourceFileName = source->GetFullPath();
+ else
+ sourceFileName = this->GetSourceFilePath(source);
explicitDeps.push_back(sourceFileName);
// Ensure that the target dependencies are built before any source file in
diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx
index ce64132..69df88d 100644
--- a/Source/cmcldeps.cxx
+++ b/Source/cmcldeps.cxx
@@ -206,7 +206,7 @@ static int process( const std::string& srcfilename,
includes.push_back(inc);
} else {
if (!isFirstLine || !startsWith(line, srcfilename)) {
- if (!quiet) {
+ if (!quiet || exit_code != 0) {
fprintf(stdout, "%s\n", line.c_str());
}
} else {
@@ -254,7 +254,10 @@ int main() {
// rc: /fo x.dir\x.rc.res -> cl: /out:x.dir\x.rc.res.dep.obj
clrest = replace(clrest, "/fo", "/out:");
clrest = replace(clrest, objfile, objfile + ".dep.obj ");
+
// rc: src\x\x.rc -> cl: /Tc src\x\x.rc
+ if (srcfile.find(" ") != std::string::npos)
+ srcfile = "\"" + srcfile + "\"";
clrest = replace(clrest, srcfile, "/Tc " + srcfile);
cl = "\"" + cl + "\" /P /DRC_INVOKED ";
@@ -267,8 +270,11 @@ int main() {
}
// extract dependencies with cl.exe
- process(srcfilename, dfile, objfile,
- prefix, cl + nol + show + clrest, objdir, true);
+ int exit_code = process(srcfilename, dfile, objfile,
+ prefix, cl + nol + show + clrest, objdir, true);
+
+ if (exit_code != 0)
+ return exit_code;
// compile rc file with rc.exe
return process(srcfilename, "" , objfile, prefix, binpath + " " + rest);
diff --git a/Utilities/Git/pre-commit b/Utilities/Git/pre-commit
index 110e9ee..d308a81 100755
--- a/Utilities/Git/pre-commit
+++ b/Utilities/Git/pre-commit
@@ -19,6 +19,26 @@ die() {
exit 1
}
+#-------------------------------------------------------------------------------
+line_too_long=80
+bad=$(regex=".{$line_too_long}" &&
+git diff-index --cached HEAD --name-only --diff-filter=AM \
+ --pickaxe-regex -S"$regex" -- 'Source/*.h' 'Source/*.cxx' |
+while read file; do
+ lines_too_long=$(git diff-index -p --cached HEAD \
+ --pickaxe-regex -S"$regex" -- "$file")
+ if echo "$lines_too_long" | egrep -q '^\+'"$regex"; then
+ echo "$lines_too_long"
+ fi
+done)
+test -z "$bad" ||
+die 'The following changes add lines too long for our C++ style:
+
+'"$bad"'
+
+Use lines strictly less than '"$line_too_long"' characters in C++ code.'
+
+#-------------------------------------------------------------------------------
if test -z "$HOOKS_ALLOW_KWSYS"; then
# Disallow changes to KWSys
files=$(git diff-index --name-only --cached HEAD -- Source/kwsys) &&