Merge branch 'cuda-arch-turing' into release-3.13

Merge-request: !2724
diff --git a/Help/release/3.13.rst b/Help/release/3.13.rst
index 9f7e61f..68e05c3 100644
--- a/Help/release/3.13.rst
+++ b/Help/release/3.13.rst
@@ -239,3 +239,16 @@
   These internal implementation modules are also no longer available
   to scripts that may have been incorrectly including them, because
   they should never have been available in the first place.
+
+Updates
+=======
+
+Changes made since CMake 3.13.0 include the following.
+
+3.13.2
+------
+
+* CMake 3.13.0 included a change to pass compiler implicit include
+  directories to the ``moc`` tool for :prop_tgt:`AUTOMOC`.  This has
+  been reverted due to regressing existing builds and will need
+  further investigation before being re-introduced in a later release.
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index c083945..623cdcd 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -88,6 +88,15 @@
   return 1;
 }
 
+static void cpackProgressCallback(const char* message, float progress,
+                                  void* clientdata)
+{
+  (void)progress;
+  (void)clientdata;
+
+  std::cout << "-- " << message << std::endl;
+}
+
 // this is CPack.
 int main(int argc, char const* const* argv)
 {
@@ -201,6 +210,7 @@
   cmake cminst(cmake::RoleScript);
   cminst.SetHomeDirectory("");
   cminst.SetHomeOutputDirectory("");
+  cminst.SetProgressCallback(cpackProgressCallback, nullptr);
   cminst.GetCurrentSnapshot().SetDefaultDefinitions();
   cmGlobalGenerator cmgg(&cminst);
   cmMakefile globalMF(&cmgg, cminst.GetCurrentSnapshot());
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 08bb2ce..846b12c 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -84,6 +84,10 @@
   bool relink)
 {
 #ifdef CMAKE_BUILD_WITH_CMAKE
+  if (!this->GlobalGenerator->GetLanguageEnabled("CUDA")) {
+    return;
+  }
+
   const std::string cuda_lang("CUDA");
   cmGeneratorTarget::LinkClosure const* closure =
     this->GeneratorTarget->GetLinkClosure(this->ConfigName);
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 6436969..8909e06 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -558,6 +558,10 @@
 
 void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
 {
+  if (!this->GetGlobalGenerator()->GetLanguageEnabled("CUDA")) {
+    return;
+  }
+
   cmGeneratorTarget& genTarget = *this->GetGeneratorTarget();
 
   // determine if we need to do any device linking for this target
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index ba7a565..f9c8c7f 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -386,9 +386,13 @@
 
   // Moc includes
   {
-    bool const appendImplicit = (this->QtVersion.Major == 5);
-    auto GetIncludeDirs =
-      [this, localGen, appendImplicit](std::string const& cfg) -> std::string {
+    // We need to disable this until we have all implicit includes available.
+    // See issue #18669.
+    // bool const appendImplicit = (this->QtVersion.Major == 5);
+
+    auto GetIncludeDirs = [this,
+                           localGen](std::string const& cfg) -> std::string {
+      bool const appendImplicit = false;
       // Get the include dirs for this target, without stripping the implicit
       // include dirs off, see
       // https://gitlab.kitware.com/cmake/cmake/issues/13667
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 334c15b..d5e834b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3331,7 +3331,8 @@
   std::vector<std::string> vsTargetVec;
   this->AddLibraries(cli, libVec, vsTargetVec, config);
   if (std::find(linkClosure->Languages.begin(), linkClosure->Languages.end(),
-                "CUDA") != linkClosure->Languages.end()) {
+                "CUDA") != linkClosure->Languages.end() &&
+      this->CudaOptions[config] != nullptr) {
     switch (this->CudaOptions[config]->GetCudaRuntime()) {
       case cmVisualStudioGeneratorOptions::CudaRuntimeStatic:
         libVec.push_back("cudadevrt.lib");
diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake
index 01ed7e9..ef11ddf 100644
--- a/Tests/QtAutogen/CommonTests.cmake
+++ b/Tests/QtAutogen/CommonTests.cmake
@@ -23,9 +23,10 @@
 if(QT_TEST_ALLOW_QT_MACROS)
   ADD_AUTOGEN_TEST(MocCMP0071)
 endif()
-if(QT_TEST_VERSION GREATER 4)
-  ADD_AUTOGEN_TEST(MocOsMacros)
-endif()
+# Disabled for issue #18669
+#if(QT_TEST_VERSION GREATER 4)
+#  ADD_AUTOGEN_TEST(MocOsMacros)
+#endif()
 ADD_AUTOGEN_TEST(UicInclude uicInclude)
 ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface)
 ADD_AUTOGEN_TEST(ObjectLibrary someProgram)
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
index e308ccb..2d7f993 100644
--- a/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/create_package.cmake
@@ -22,3 +22,5 @@
 expect_file(${CPACK_TEMPORARY_DIRECTORY}/f2/share/cpack-test/f2.txt)
 expect_file(${CPACK_TEMPORARY_DIRECTORY}/f3/share/cpack-test/f3.txt)
 expect_file(${CPACK_TEMPORARY_DIRECTORY}/f4/share/cpack-test/f4.txt)
+
+message(STATUS "This status message is expected to be visible")
diff --git a/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt
new file mode 100644
index 0000000..37d635f
--- /dev/null
+++ b/Tests/RunCMake/CPack/tests/EXTERNAL/stage_and_package-stdout.txt
@@ -0,0 +1 @@
+-- This status message is expected to be visible
diff --git a/Tests/RunCMake/Languages/ExternalCUDA.cmake b/Tests/RunCMake/Languages/ExternalCUDA.cmake
new file mode 100644
index 0000000..3afa93e
--- /dev/null
+++ b/Tests/RunCMake/Languages/ExternalCUDA.cmake
@@ -0,0 +1,8 @@
+enable_language(C)
+
+add_library(ext_cuda IMPORTED STATIC)
+set_property(TARGET ext_cuda PROPERTY IMPORTED_LOCATION "/does_not_exist")
+set_property(TARGET ext_cuda PROPERTY IMPORTED_LINK_INTERFACE_LANGUAGES "CUDA")
+
+add_executable(main empty.c)
+target_link_libraries(main ext_cuda)
diff --git a/Tests/RunCMake/Languages/RunCMakeTest.cmake b/Tests/RunCMake/Languages/RunCMakeTest.cmake
index 732baae..2a534b3 100644
--- a/Tests/RunCMake/Languages/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Languages/RunCMakeTest.cmake
@@ -6,3 +6,5 @@
 run_cmake(link-libraries-TARGET_FILE-genex-ok)
 
 run_cmake(DetermineFail)
+
+run_cmake(ExternalCUDA)
diff --git a/Tests/RunCMake/Languages/empty.c b/Tests/RunCMake/Languages/empty.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/Languages/empty.c