From dc8822f0a7b4152c5cb880e6a7fccada767e2fb1 Mon Sep 17 00:00:00 2001 From: Matt McCormick Date: Wed, 19 Aug 2015 22:40:38 -0400 Subject: [PATCH 1/7] CMakeDetermine{C,CXX}Compiler: Avoid if() auto-dereferene in quoted arguments Exposed by a CMP0054 warning with code like: cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) project(MyProj NONE) enable_language(C) enable_language(CXX) While at it, use STREQUAL for testing the compiler id against "GNU". Suggested-by: Rolf Eike Beer --- Modules/CMakeDetermineCCompiler.cmake | 7 ++++--- Modules/CMakeDetermineCXXCompiler.cmake | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 937aa8c3e..db477cb6a 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -95,6 +95,7 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) # Try to identify the compiler. set(CMAKE_C_COMPILER_ID) + set(CMAKE_C_PLATFORM_ID) file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in CMAKE_C_COMPILER_ID_PLATFORM_CONTENT) @@ -108,12 +109,12 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) CMAKE_DETERMINE_COMPILER_ID(C CFLAGS CMakeCCompilerId.c) # Set old compiler and platform id variables. - if(CMAKE_C_COMPILER_ID MATCHES "GNU") + if(CMAKE_C_COMPILER_ID STREQUAL "GNU") set(CMAKE_COMPILER_IS_GNUCC 1) endif() - if("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW") + if(CMAKE_C_PLATFORM_ID MATCHES "MinGW") set(CMAKE_COMPILER_IS_MINGW 1) - elseif("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin") + elseif(CMAKE_C_PLATFORM_ID MATCHES "Cygwin") set(CMAKE_COMPILER_IS_CYGWIN 1) endif() endif() diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 893c454cc..18e735bdc 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -90,6 +90,7 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) # Try to identify the compiler. set(CMAKE_CXX_COMPILER_ID) + set(CMAKE_CXX_PLATFORM_ID) file(READ ${CMAKE_ROOT}/Modules/CMakePlatformId.h.in CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT) @@ -103,12 +104,12 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) CMAKE_DETERMINE_COMPILER_ID(CXX CXXFLAGS CMakeCXXCompilerId.cpp) # Set old compiler and platform id variables. - if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CMAKE_COMPILER_IS_GNUCXX 1) endif() - if("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW") + if(CMAKE_CXX_PLATFORM_ID MATCHES "MinGW") set(CMAKE_COMPILER_IS_MINGW 1) - elseif("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin") + elseif(CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin") set(CMAKE_COMPILER_IS_CYGWIN 1) endif() endif() From b3372db588431f000b5fe3de980d6a2f27382eb1 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 16 Jul 2015 21:47:29 +0200 Subject: [PATCH 2/7] cmExtra{Kate,SublimeText}Generator: Remove unused cmXMLSafe includes --- Source/cmExtraKateGenerator.cxx | 1 - Source/cmExtraSublimeTextGenerator.cxx | 1 - 2 files changed, 2 deletions(-) diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 578e7d332..f83b5cf68 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -19,7 +19,6 @@ #include "cmGeneratedFileStream.h" #include "cmTarget.h" #include "cmSystemTools.h" -#include "cmXMLSafe.h" #include diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 4e721d4cb..163a75bb4 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -21,7 +21,6 @@ #include "cmSourceFile.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmXMLSafe.h" #include From dee84dc73d88d05b9ad66908780c3e7c6ddc67ef Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 16 Jul 2015 21:47:29 +0200 Subject: [PATCH 3/7] cmCTest{BZR,GIT,P4}: Remove unused cmXMLSafe includes --- Source/CTest/cmCTestBZR.cxx | 1 - Source/CTest/cmCTestGIT.cxx | 1 - Source/CTest/cmCTestP4.cxx | 1 - 3 files changed, 3 deletions(-) diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 3014a9322..587b583ce 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -14,7 +14,6 @@ #include "cmCTest.h" #include "cmSystemTools.h" #include "cmXMLParser.h" -#include "cmXMLSafe.h" #include diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 6b84bab64..c32e87657 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -14,7 +14,6 @@ #include "cmCTest.h" #include "cmSystemTools.h" #include "cmAlgorithms.h" -#include "cmXMLSafe.h" #include #include diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 31002a623..ad8e8b340 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -13,7 +13,6 @@ #include "cmCTest.h" #include "cmSystemTools.h" -#include "cmXMLSafe.h" #include #include From ab2524d63f651e6d96c770fb3571bddab4b86621 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 16 Jul 2015 21:48:00 +0200 Subject: [PATCH 4/7] CTest: Fix XML double-encoding cases Remove use of cmXMLSafe from CTest when generating content that is later handled by cmXMLWriter. This was broken by refactoring in the topic merged by commit v3.3.0-rc1~22 (Merge topic 'ctest-xml-refactor', 2015-05-28). --- Source/CTest/cmCTestMemCheckHandler.cxx | 16 ++++++---------- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmCTest.cxx | 5 +---- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 8f267163d..acf527acd 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -80,8 +80,8 @@ public: int i = 0; for(; atts[i] != 0; i+=2) { - ostr << " " << cmXMLSafe(atts[i]) - << " - " << cmXMLSafe(atts[i+1]) << "\n"; + ostr << " " << atts[i] + << " - " << atts[i+1] << "\n"; } ostr << "\n"; this->Log += ostr.str(); @@ -856,7 +856,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput( defects++; ostr << "" << this->ResultStrings[idx] << " "; } - ostr << cmXMLSafe(*i) << std::endl; + ostr << *i << std::endl; } log = ostr.str(); if(defects) @@ -908,7 +908,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput( results[failure] ++; defects ++; } - ostr << cmXMLSafe(*i) << std::endl; + ostr << *i << std::endl; } log = ostr.str(); @@ -1056,7 +1056,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( defects ++; } totalOutputSize += lines[cc].size(); - ostr << cmXMLSafe(lines[cc]) << std::endl; + ostr << lines[cc] << std::endl; } else { @@ -1070,11 +1070,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i) { totalOutputSize += lines[*i].size(); - cmCTestOptionalLog(this->CTest, DEBUG, "before xml safe " - << lines[*i] << std::endl, this->Quiet); - cmCTestOptionalLog(this->CTest, DEBUG, "after xml safe " - << cmXMLSafe(lines[*i]) << std::endl, this->Quiet); - ostr << cmXMLSafe(lines[*i]) << std::endl; + ostr << lines[*i] << std::endl; if(!unlimitedOutput && totalOutputSize > static_cast(this->CustomMaximumFailedTestOutputSize)) { diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 2af09cbf9..f93b87b90 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2070,7 +2070,7 @@ bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length) } current = next; } - else // Bad byte will be handled by cmXMLSafe. + else // Bad byte will be handled by cmXMLWriter. { ++current; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index e3b7a2bcb..8fa19d24a 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -22,7 +22,6 @@ #include #include "cmDynamicLoader.h" #include "cmGeneratedFileStream.h" -#include "cmXMLSafe.h" #include "cmVersionMacros.h" #include "cmCTestCommand.h" #include "cmCTestStartCommand.h" @@ -156,7 +155,7 @@ std::string cmCTest::CurrentTime() strftime(current_time, 1000, "%a %b %d %H:%M:%S %Z %Y", t); } cmCTestLog(this, DEBUG, " Current_Time: " << current_time << std::endl); - return cmXMLSafe(cmCTest::CleanString(current_time)).str(); + return cmCTest::CleanString(current_time); } //---------------------------------------------------------------------- @@ -1477,8 +1476,6 @@ std::string cmCTest::SafeBuildIdField(const std::string& value) cmSystemTools::ReplaceString(safevalue, replace, ""); } } - - safevalue = cmXMLSafe(safevalue).str(); } if (safevalue == "") From bfb9d34f8afe66c2ce344b36db48568fc88950c9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 27 Aug 2015 16:41:34 -0400 Subject: [PATCH 5/7] Makefile: Print color escapes only when necessary Teach cmSystemTools::MakefileColorEcho to use the color printing API only when we actually have a color to print. This avoids printing escape sequences that do not change the text attributes. Since commit v3.3.0-rc1~480^2~4 (Makefile: Fix output during parallel builds, 2015-02-05) we always use this code path to print progress and rule messages even when color is disabled (e.g. in a try_compile). It is important to avoid printing escapes when there is no color because on MSYS we have no isatty and so assume that vt100 escapes are supported, but we do not want to print them when capturing try_compile output. If we capture the vt100 escapes in try_compile output, they contain unbalanced square brackets. This causes CMakeParseImplicitLinkInfo to fail to separate lines in a ;-list and therefore fail to extract information from the link line. Then mixed-language linking breaks. --- Source/cmSystemTools.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index e2adabe5f..b440a177b 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2331,7 +2331,7 @@ void cmSystemTools::MakefileColorEcho(int color, const char* message, assumeTTY = 0; } - if(enabled) + if(enabled && color != cmsysTerminal_Color_Normal) { // Print with color. Delay the newline until later so that // all color restore sequences appear before it. From 02440154fb457e481d44aa0a2c2134e1a66e0f4b Mon Sep 17 00:00:00 2001 From: Chuck Atkins Date: Wed, 9 Sep 2015 16:03:04 -0400 Subject: [PATCH 6/7] find_*: Fix search order when the environment duplicates some HINTS Refactoring in the topic merged by commit v3.2.0-rc1~400 (Merge topic 'refactor-search-path-construction', 2014-11-13) introduced a bug that filters out duplicate paths in an incorrect order. Restore the search path to its documented order even when duplicate paths are present. Reported-by: Marc CHEVRIER --- Source/cmFindBase.cxx | 6 ++++-- Source/cmFindPackageCommand.cxx | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index add06a730..e2f86ce89 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -207,6 +207,10 @@ void cmFindBase::ExpandPaths() { this->FillCMakeEnvironmentPath(); } + } + this->FillUserHintsPath(); + if(!this->NoDefaultPath) + { if(!this->NoSystemEnvironmentPath) { this->FillSystemEnvironmentPath(); @@ -216,8 +220,6 @@ void cmFindBase::ExpandPaths() this->FillCMakeSystemVariablePath(); } } - - this->FillUserHintsPath(); this->FillUserGuessPath(); } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 68a6558fe..bf4033ec3 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1133,6 +1133,10 @@ void cmFindPackageCommand::ComputePrefixes() { this->FillPrefixesCMakeEnvironment(); } + } + this->FillPrefixesUserHints(); + if(!this->NoDefaultPath) + { if(!this->NoSystemEnvironmentPath) { this->FillPrefixesSystemEnvironment(); @@ -1150,7 +1154,6 @@ void cmFindPackageCommand::ComputePrefixes() this->FillPrefixesSystemRegistry(); } } - this->FillPrefixesUserHints(); this->FillPrefixesUserGuess(); this->ComputeFinalPaths(); From 650c630a663b2d0663e6ef6acda2a5fb94e5a621 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 16 Sep 2015 11:46:31 -0400 Subject: [PATCH 7/7] CMake 3.3.2 --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e1bffac2f..a9785ef34 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 3) -set(CMake_VERSION_PATCH 1) +set(CMake_VERSION_PATCH 2) #set(CMake_VERSION_RC 0)