From bb6663ca0a73872b063477e92272418b7d49e39b Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 30 Apr 2015 15:25:16 -0400 Subject: [PATCH 1/6] Makefile: Workaround mingw32-make trailing backslash trouble (#15546) When given the command line tool a\ b c mingw32-make incorrectly passes "a b" and "c" to the tool. When given the command line tool a\ b "c" mingw32-make correctly passes "a\", "b", and "c" to the tool. Since commit v3.1.0-rc1~861^2 (MSVC: Add properties to configure compiler PDB files, 2014-02-24) we pass the compiler pdb option to MS-style compiler tools as "/Fd\" but mingw32-make may consume the backslash as escaping a following space as described above. Workaround this problem by changing the backslash to a forward slash as had been used prior to the above commit. --- Source/cmLocalUnixMakefileGenerator3.h | 1 + Source/cmMakefileTargetGenerator.cxx | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 4f2e4a035..c9b9ccc70 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -95,6 +95,7 @@ public: * Set to true if the make tool being used is MinGW Make. */ void SetMinGWMake(bool v) {this->MinGWMake = v;} + bool IsMinGWMake() const { return this->MinGWMake; } /** * Set to true if the make tool being used is NMake. diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index ea11c79c0..b7e4e3722 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -23,6 +23,7 @@ #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratorExpression.h" +#include "cmAlgorithms.h" #include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h" @@ -668,6 +669,15 @@ cmMakefileTargetGenerator this->Convert(targetFullPathCompilePDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); + + if (this->LocalGenerator->IsMinGWMake() && + cmHasLiteralSuffix(targetOutPathCompilePDB, "\\")) + { + // mingw32-make incorrectly interprets 'a\ b c' as 'a b' and 'c' + // (but 'a\ b "c"' as 'a\', 'b', and 'c'!). Workaround this by + // avoiding a trailing backslash in the argument. + targetOutPathCompilePDB[targetOutPathCompilePDB.size()-1] = '/'; + } } cmLocalGenerator::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; From 9b2778d412351db9c8c7f667335cbdf51b555124 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 4 May 2015 11:57:42 -0400 Subject: [PATCH 2/6] InstallRequiredSystemLibraries: Update for VS 2015 (#15552) The part of the MS C Runtime library that applications need to distribute has been renamed from "msvcr*.dll" to "vcruntime*.dll" starting with VS 2015. See the Visual C++ Team Blog: Introducing the Universal CRT http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx --- Modules/InstallRequiredSystemLibraries.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 5afb517d6..d8ede1c1e 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -172,8 +172,12 @@ if(MSVC) if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) set(__install__libs "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll" - "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll" ) + if(NOT v VERSION_LESS 14) + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0.dll") + else() + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll") + endif() else() set(__install__libs) endif() @@ -183,8 +187,12 @@ if(MSVC) "${MSVC${v}_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC${v}0.DebugCRT") set(__install__libs ${__install__libs} "${MSVC${v}_CRT_DIR}/msvcp${v}0d.dll" - "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll" ) + if(NOT v VERSION_LESS 14) + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/vcruntime${v}0d.dll") + else() + list(APPEND __install__libs "${MSVC${v}_CRT_DIR}/msvcr${v}0d.dll") + endif() endif() endmacro() From 3a65606591818281ba75bac4751e07c69751451f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 18 May 2015 10:31:42 -0400 Subject: [PATCH 3/6] Fix assertion failure on unmatched foreach in function (#15572) The lexical scope counting added by commit v3.2.0-rc1~332^2~1 (Track nested loop levels in CMake language with a stack of counters, 2014-11-18) forgot to account for scopes popped by error messages about unclosed scopes. Teach the error handler to pop the lexical scope it reports as unclosed. Re-order the lexical scope RAII object to be inside the variable scope RAII object scope so that the lexical scope is fully closed before we check assertions about variable scopes. Extend the RunCMake.Syntax test with a case covering this. --- Source/cmFunctionCommand.cxx | 2 +- Source/cmMakefile.cxx | 1 + Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt | 1 + Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt | 8 ++++++++ Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake | 5 +++++ Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt | 1 + Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt | 8 ++++++++ Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake | 5 +++++ Tests/RunCMake/Syntax/RunCMakeTest.cmake | 4 ++++ 9 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt create mode 100644 Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt create mode 100644 Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake create mode 100644 Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt create mode 100644 Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt create mode 100644 Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index c33048c81..4a0efc10e 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -94,8 +94,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass } // we push a scope on the makefile - cmMakefile::LexicalPushPop lexScope(this->Makefile); cmMakefile::ScopePushPop varScope(this->Makefile); + cmMakefile::LexicalPushPop lexScope(this->Makefile); static_cast(varScope); // Push a weak policy scope which restores the policies recorded at diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ba914e151..61a175c78 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3284,6 +3284,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError) this->FunctionBlockerBarriers.back(); while(this->FunctionBlockers.size() > barrier) { + cmMakefile::LoopBlockPop loopBlockPop(this); cmsys::auto_ptr fb(this->FunctionBlockers.back()); this->FunctionBlockers.pop_back(); if(reportError) diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt new file mode 100644 index 000000000..f4ff70945 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at FunctionUnmatchedForeach.cmake:[0-9]+ \(f\): + A logical block opening on the line + + .*/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake:[0-9]+ \(foreach\) + + is not closed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake new file mode 100644 index 000000000..ee9c18459 --- /dev/null +++ b/Tests/RunCMake/Syntax/FunctionUnmatchedForeach.cmake @@ -0,0 +1,5 @@ +function(f) + foreach(i 1) + #endforeach() # missing +endfunction() +f() diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt new file mode 100644 index 000000000..820cd2e5a --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach-stderr.txt @@ -0,0 +1,8 @@ +^CMake Error at MacroUnmatchedForeach.cmake:[0-9]+ \(m\): + A logical block opening on the line + + .*/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake:[0-9]+ \(foreach\) + + is not closed. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake b/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake new file mode 100644 index 000000000..be443dd9b --- /dev/null +++ b/Tests/RunCMake/Syntax/MacroUnmatchedForeach.cmake @@ -0,0 +1,5 @@ +macro(m) + foreach(i 1) + #endforeach() # missing +endmacro() +m() diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index cecd33832..c43128087 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -108,3 +108,7 @@ run_cmake(CMP0053-NameWithNewlineQuoted) run_cmake(CMP0053-NameWithCarriageReturnQuoted) run_cmake(CMP0053-NameWithEscapedSpacesQuoted) run_cmake(CMP0053-NameWithEscapedTabsQuoted) + +# Function and macro tests. +run_cmake(FunctionUnmatchedForeach) +run_cmake(MacroUnmatchedForeach) From 44a4e54547a817546d3a12ed6ce8f16c62a76be8 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Wed, 27 May 2015 11:23:15 -0400 Subject: [PATCH 4/6] ctest_build: Fix regression in GNU make error message matching The regex update in commit v3.1.2~4^2 (ctest_build: Update GNU make error message matching, 2015-01-28) broke matching of the messages it updated. Remove the escape character before the square brackets added by that commit. --- Source/CTest/cmCTestBuildHandler.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 13404a821..c741527a9 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -70,13 +70,13 @@ static const char* cmCTestErrorMatches[] = { "^CMake Error.*:", ":[ \\t]cannot find", ":[ \\t]can't find", - ": \\*\\*\\* No rule to make target \\[`'].*\\'. Stop", + ": \\*\\*\\* No rule to make target [`'].*\\'. Stop", ": \\*\\*\\* No targets specified and no makefile found", ": Invalid loader fixup for symbol", ": Invalid fixups exist", ": Can't find library for", ": internal link edit command failed", - ": Unrecognized option \\[`'].*\\'", + ": Unrecognized option [`'].*\\'", "\", line [0-9]+\\.[0-9]+: [0-9]+-[0-9]+ \\([^WI]\\)", "ld: 0706-006 Cannot find or open library file: -l ", "ild: \\(argument error\\) can't find library argument ::", From bfa57c5f80278abc044b7342e81e5aaad82bffab Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 1 Jun 2015 11:06:25 -0400 Subject: [PATCH 5/6] Makefile: Fix compilation after parent commit was backported The CMake 3.2 release branch does not have 'cmAlgorithms.h' and simply provides 'cmHasLiteralSuffix' in 'cmStandardIncludes.h' instead. --- Source/cmMakefileTargetGenerator.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index b7e4e3722..e98354653 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -23,7 +23,6 @@ #include "cmComputeLinkInformation.h" #include "cmCustomCommandGenerator.h" #include "cmGeneratorExpression.h" -#include "cmAlgorithms.h" #include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h" From b3de2a8e6451c9138948c23a974740823ade8263 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 1 Jun 2015 09:39:26 -0400 Subject: [PATCH 6/6] CMake 3.2.3 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 27bebc817..34ceaf2b1 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 2) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0)