Merge topic 'autogen_test_fix'

91344e7a46 Autogen: Fix RerunMocPlugin test for Ninja generator

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2971
diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake
index b3c96ee..d34154c 100644
--- a/Modules/Compiler/Cray-C.cmake
+++ b/Modules/Compiler/Cray-C.cmake
@@ -8,13 +8,13 @@
 string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG")
 
 if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
-  set(CMAKE_C90_STANDARD_COMPILE_OPTION  "-h noc99,conform")
-  set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-h noc99,gnu")
-  set(CMAKE_C99_STANDARD_COMPILE_OPTION  "-h c99,conform")
-  set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-h c99,gnu")
+  set(CMAKE_C90_STANDARD_COMPILE_OPTION  -h noc99,conform)
+  set(CMAKE_C90_EXTENSION_COMPILE_OPTION -h noc99,gnu)
+  set(CMAKE_C99_STANDARD_COMPILE_OPTION  -h c99,conform)
+  set(CMAKE_C99_EXTENSION_COMPILE_OPTION -h c99,gnu)
   if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.5)
-    set(CMAKE_C11_STANDARD_COMPILE_OPTION  "-h std=c11,conform")
-    set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-h std=c11,gnu")
+    set(CMAKE_C11_STANDARD_COMPILE_OPTION  -h std=c11,conform)
+    set(CMAKE_C11_EXTENSION_COMPILE_OPTION -h std=c11,gnu)
   endif ()
 endif ()
 
diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake
index bbb5718..85a3167 100644
--- a/Modules/Compiler/Cray-CXX.cmake
+++ b/Modules/Compiler/Cray-CXX.cmake
@@ -8,15 +8,15 @@
 string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG")
 
 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)
-  set(CMAKE_CXX98_STANDARD_COMPILE_OPTION  "-h conform")
-  set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-h gnu")
+  set(CMAKE_CXX98_STANDARD_COMPILE_OPTION  -h conform)
+  set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION -h gnu)
   if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.4)
-    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION  "-h std=c++11")
-    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-h std=c++11,gnu")
+    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION  -h std=c++11)
+    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION -h std=c++11,gnu)
   endif()
   if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.6)
-    set(CMAKE_CXX14_STANDARD_COMPILE_OPTION  "-h std=c++14")
-    set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-h std=c++14,gnu")
+    set(CMAKE_CXX14_STANDARD_COMPILE_OPTION  -h std=c++14)
+    set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION -h std=c++14,gnu)
   endif ()
 endif ()
 
diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake
index 1a2af16..47c0e79 100644
--- a/Modules/FindLibXml2.cmake
+++ b/Modules/FindLibXml2.cmake
@@ -18,7 +18,7 @@
 
 This module will set the following variables in your project:
 
-``LIBXML2_FOUND``
+``LibXml2_FOUND``
   true if libxml2 headers and libraries were found
 ``LIBXML2_INCLUDE_DIR``
   the directory containing LibXml2 headers
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e69ceb9..6af2c8e 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 14)
-set(CMake_VERSION_PATCH 20190215)
+set(CMake_VERSION_PATCH 20190218)
 #set(CMake_VERSION_RC 1)
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index bd110ec..eb52895 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -226,7 +226,7 @@
     } else if (doing == DoingCMakeFlags) {
       cmakeFlags.push_back(argv[i]);
     } else if (doing == DoingCompileDefinitions) {
-      compileDefs.push_back(argv[i]);
+      cmSystemTools::ExpandListArgument(argv[i], compileDefs);
     } else if (doing == DoingLinkOptions) {
       linkOptions.push_back(argv[i]);
     } else if (doing == DoingLinkLibraries) {
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index aa75a8c..aec5a44 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -3756,7 +3756,7 @@
 
   // Check if copy-on-error is enabled in the arguments.
   if (!completed && copyOnErrorArg.IsEnabled()) {
-    completed = cmSystemTools::cmCopyFile(fileName, newFileName);
+    completed = cmsys::SystemTools::CopyFileAlways(fileName, newFileName);
     if (!completed) {
       result = "Copy failed: " + cmSystemTools::GetLastSystemError();
     }
diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
index 12d9304..913fc4a 100644
--- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx
+++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx
@@ -453,7 +453,8 @@
         "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
         "Windows Kits\\Installed Roots;KitsRoot81",
         win81Root, cmSystemTools::KeyWOW64_32)) {
-    return cmSystemTools::FileExists(win81Root + "/um/windows.h", true);
+    return cmSystemTools::FileExists(win81Root + "/include/um/windows.h",
+                                     true);
   }
   return false;
 }
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 998729f..8d2586d 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -454,6 +454,7 @@
   if (lang == "Swift") {
     vars.SwiftAuxiliarySources = "$SWIFT_AUXILIARY_SOURCES";
     vars.SwiftModuleName = "$SWIFT_MODULE_NAME";
+    vars.SwiftLibraryName = "$SWIFT_LIBRARY_NAME";
   }
 
   // For some cases we do an explicit preprocessor invocation.
@@ -940,6 +941,10 @@
     } else {
       vars["SWIFT_MODULE_NAME"] = this->GeneratorTarget->GetName();
     }
+
+    cmGeneratorTarget::Names targetNames =
+      this->GeneratorTarget->GetLibraryNames(this->GetConfigName());
+    vars["SWIFT_LIBRARY_NAME"] = targetNames.Base;
   }
 
   if (!this->NeedDepTypeMSVC(language)) {
diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx
index ddff4cf..2959b7d 100644
--- a/Source/cmQtAutoGeneratorMocUic.cxx
+++ b/Source/cmQtAutoGeneratorMocUic.cxx
@@ -1020,20 +1020,20 @@
 void cmQtAutoGeneratorMocUic::WorkerT::LogInfo(
   GeneratorT genType, std::string const& message) const
 {
-  return Log().Info(genType, message);
+  Log().Info(genType, message);
 }
 
 void cmQtAutoGeneratorMocUic::WorkerT::LogWarning(
   GeneratorT genType, std::string const& message) const
 {
-  return Log().Warning(genType, message);
+  Log().Warning(genType, message);
 }
 
 void cmQtAutoGeneratorMocUic::WorkerT::LogFileWarning(
   GeneratorT genType, std::string const& filename,
   std::string const& message) const
 {
-  return Log().WarningFile(genType, filename, message);
+  Log().WarningFile(genType, filename, message);
 }
 
 void cmQtAutoGeneratorMocUic::WorkerT::LogError(
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx
index e347a2c..5ebdd1b 100644
--- a/Source/cmRulePlaceholderExpander.cxx
+++ b/Source/cmRulePlaceholderExpander.cxx
@@ -172,6 +172,11 @@
       return replaceValues.SwiftModuleName;
     }
   }
+  if (replaceValues.SwiftLibraryName) {
+    if (variable == "SWIFT_LIBRARY_NAME") {
+      return replaceValues.SwiftLibraryName;
+    }
+  }
   if (variable == "TARGET_SONAME" || variable == "SONAME_FLAG" ||
       variable == "TARGET_INSTALLNAME_DIR") {
     // All these variables depend on TargetSOName
diff --git a/Source/cmRulePlaceholderExpander.h b/Source/cmRulePlaceholderExpander.h
index 5c03637..930eafd 100644
--- a/Source/cmRulePlaceholderExpander.h
+++ b/Source/cmRulePlaceholderExpander.h
@@ -60,6 +60,7 @@
     const char* FilterPrefix;
     const char* SwiftAuxiliarySources;
     const char* SwiftModuleName;
+    const char* SwiftLibraryName;
   };
 
   // Expand rule variables in CMake of the type found in language rules
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index a5d191d..f544fa1 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -935,12 +935,6 @@
   return "";
 }
 
-bool cmSystemTools::cmCopyFile(const std::string& source,
-                               const std::string& destination)
-{
-  return Superclass::CopyFileAlways(source, destination);
-}
-
 #ifdef _WIN32
 cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry()
 {
@@ -1388,14 +1382,6 @@
   return cmSystemTools::UNKNOWN_FILE_FORMAT;
 }
 
-bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
-{
-  std::vector<std::string> temp;
-  bool res = Superclass::Split(s, temp);
-  l.insert(l.end(), temp.begin(), temp.end());
-  return res;
-}
-
 std::string cmSystemTools::ConvertToOutputPath(std::string const& path)
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h
index ba6de51..82e4f01 100644
--- a/Source/cmSystemTools.h
+++ b/Source/cmSystemTools.h
@@ -172,10 +172,6 @@
   static bool SimpleGlob(const std::string& glob,
                          std::vector<std::string>& files, int type = 0);
 
-  ///! Copy a file.
-  static bool cmCopyFile(const std::string& source,
-                         const std::string& destination);
-
   /** Rename a file or directory within a single disk volume (atomic
       if possible).  */
   static bool RenameFile(const std::string& oldname,
@@ -347,9 +343,6 @@
                          cmDuration timeout, std::vector<char>& out,
                          std::vector<char>& err);
 
-  /** Split a string on its newlines into multiple lines.  Returns
-      false only if the last line stored had no newline.  */
-  static bool Split(const char* s, std::vector<std::string>& l);
   static void SetForceUnixPaths(bool v) { s_ForceUnixPaths = v; }
   static bool GetForceUnixPaths() { return s_ForceUnixPaths; }
 
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ff6b04b..dd29c0c 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2354,7 +2354,7 @@
   outFile += "/CMakeLists.txt";
 
   // Copy file
-  if (!cmSystemTools::cmCopyFile(inFile, outFile)) {
+  if (!cmsys::SystemTools::CopyFileAlways(inFile, outFile)) {
     std::cerr << "Error copying file \"" << inFile << "\" to \"" << outFile
               << "\".\n";
     return 1;
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 4415ba6..21802ad 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -482,7 +482,7 @@
       // If error occurs we want to continue copying next files.
       bool return_value = false;
       for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
-        if (!cmSystemTools::cmCopyFile(args[cc], args.back())) {
+        if (!cmsys::SystemTools::CopyFileAlways(args[cc], args.back())) {
           std::cerr << "Error copying file \"" << args[cc] << "\" to \""
                     << args.back() << "\".\n";
           return_value = true;
diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in
index bd4a176..4c3bde1 100644
--- a/Source/kwsys/Glob.hxx.in
+++ b/Source/kwsys/Glob.hxx.in
@@ -41,17 +41,9 @@
       , content(c)
     {
     }
-    Message(const Message& msg)
-      : type(msg.type)
-      , content(msg.content)
-    {
-    }
-    Message& operator=(Message const& msg)
-    {
-      this->type = msg.type;
-      this->content = msg.content;
-      return *this;
-    }
+    ~Message() = default;
+    Message(const Message& msg) = default;
+    Message& operator=(Message const& msg) = default;
   };
 
   typedef std::vector<Message> GlobMessages;
diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in
index fc0d60e..0981c66 100644
--- a/Source/kwsys/hashtable.hxx.in
+++ b/Source/kwsys/hashtable.hxx.in
@@ -73,7 +73,7 @@
   void public_method_to_quiet_warning_about_all_methods_private();
 
 private:
-  void operator=(_Hashtable_node<_Val> const&); // poison node assignment
+  void operator=(_Hashtable_node<_Val> const&) = delete;
 };
 
 template <class _Val, class _Key, class _HashFcn, class _ExtractKey,
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index 616092d..b584e16 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -128,7 +128,8 @@
 endif()
 
 # for msvc the compiler version determines which c++11 features are available.
-if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC")
+if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
+    OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC"))
   if(";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_delegating_constructors;")
     list(APPEND true_defs EXPECTED_COMPILER_CXX_DELEGATING_CONSTRUCTORS)
     list(APPEND true_defs EXPECTED_COMPILER_CXX_VARIADIC_TEMPLATES)
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 184a7be..54e96a2 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -165,6 +165,35 @@
   OUTPUT_VARIABLE output)
 TEST_ASSERT(TEST_INNER "try_compile project mode failed:\n${output}")
 
+try_compile(COMPILE_DEFINITIONS_LIST_EXPANDED
+    ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+    ${TryCompile_SOURCE_DIR}/check_a_b.c
+    OUTPUT_VARIABLE output
+    COMPILE_DEFINITIONS "-DDEF_A;-DDEF_B"
+    )
+if(COMPILE_DEFINITIONS_LIST_EXPANDED)
+  message(STATUS "COMPILE_DEFINITIONS list expanded correctly")
+else()
+  string(REPLACE "\n" "\n  " output "  ${output}")
+  message(SEND_ERROR "COMPILE_DEFINITIONS list did not expand correctly\n${output}")
+endif()
+
+try_compile(SHOULD_FAIL_DUE_TO_BAD_SOURCE
+    ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+    ${TryCompile_SOURCE_DIR}/pass.c
+    OUTPUT_VARIABLE output
+    COMPILE_DEFINITIONS "bad#source.c"
+    )
+if(SHOULD_FAIL_DUE_TO_BAD_SOURCE AND NOT CMAKE_GENERATOR MATCHES "Watcom WMake|NMake Makefiles")
+  string(REPLACE "\n" "\n  " output "  ${output}")
+  message(SEND_ERROR "try_compile with bad#source.c did not fail:\n${output}")
+elseif(NOT output MATCHES [[(bad#source\.c|bad\\)]])
+  string(REPLACE "\n" "\n  " output "  ${output}")
+  message(SEND_ERROR "try_compile with bad#source.c failed without mentioning bad source:\n${output}")
+else()
+  message(STATUS "try_compile with bad#source.c correctly failed")
+endif()
+
 add_executable(TryCompile pass.c)
 
 ######################################
diff --git a/Tests/TryCompile/check_a_b.c b/Tests/TryCompile/check_a_b.c
new file mode 100644
index 0000000..05fba0f
--- /dev/null
+++ b/Tests/TryCompile/check_a_b.c
@@ -0,0 +1,10 @@
+#ifndef DEF_A
+#  error DEF_A not defined
+#endif
+#ifndef DEF_B
+#  error DEF_B not defined
+#endif
+int main()
+{
+  return 0;
+}