This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  395e5f77fcd900b4a7a48eaa2da2e3554b694cf1 (commit)
       via  a988cc8789bf00dd8783192f95e02ccbfea78302 (commit)
       via  f9e2c17458d5d9998b8b87a953b50a4837fe80e9 (commit)
       via  38c1f2ab222d4174137722a890c2a730d9083e2f (commit)
       via  1144a4fa47d467ac3bd2f70ed2dffd04734d53a7 (commit)
       via  83c1657ff7fda3dc86b49bc9039f59449f2d8ae4 (commit)
       via  bc4f8f4472ae94b7053ee373a7406774900f350c (commit)
      from  65020633e62eaf0d86f85bcf1240caacd2095de9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=395e5f77fcd900b4a7a48eaa2da2e3554b694cf1
commit 395e5f77fcd900b4a7a48eaa2da2e3554b694cf1
Merge: a988cc8 83c1657
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Fri Oct 4 14:13:13 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Fri Oct 4 10:15:08 2019 -0400

    Merge topic 'unity-step'
    
    83c1657ff7 Unity build: Generate sources during Compute step
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3884


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a988cc8789bf00dd8783192f95e02ccbfea78302
commit a988cc8789bf00dd8783192f95e02ccbfea78302
Merge: f9e2c17 38c1f2a
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Fri Oct 4 14:13:00 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Fri Oct 4 10:14:20 2019 -0400

    Merge topic 'pch-multi-language'
    
    38c1f2ab22 PCH: Fix CMake test files indentation
    1144a4fa47 PCH: Add multi-language PCH generation support
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3885


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f9e2c17458d5d9998b8b87a953b50a4837fe80e9
commit f9e2c17458d5d9998b8b87a953b50a4837fe80e9
Merge: 6502063 bc4f8f4
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Fri Oct 4 14:12:51 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Fri Oct 4 10:13:00 2019 -0400

    Merge topic 'pch-clang-pch-regen'
    
    bc4f8f4472 PCH: Use clang's own pch functionality instead of the GCC 
emulation
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !3881


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=38c1f2ab222d4174137722a890c2a730d9083e2f
commit 38c1f2ab222d4174137722a890c2a730d9083e2f
Author:     Cristian Adam <cristian.a...@gmail.com>
AuthorDate: Thu Oct 3 23:11:02 2019 +0200
Commit:     Cristian Adam <cristian.a...@gmail.com>
CommitDate: Thu Oct 3 23:24:21 2019 +0200

    PCH: Fix CMake test files indentation

diff --git a/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake 
b/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake
index fa37c2c..8cf0fc9 100644
--- a/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/DisabledPch-check.cmake
@@ -1,17 +1,17 @@
 if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
-    set(foo_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/CMakeFiles/foo.dir/cmake_pch.h")
-    set(foobar_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h")
+  set(foo_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/CMakeFiles/foo.dir/cmake_pch.h")
+  set(foobar_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h")
 else()
-    set(foo_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h")
-    set(foobar_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h")
+  set(foo_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foo.dir/cmake_pch.h")
+  set(foobar_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h")
 endif()
 
 if (NOT EXISTS ${foo_pch_header})
-   set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} does 
not exist")
-   return()
+  set(RunCMake_TEST_FAILED "Generated foo pch header ${foo_pch_header} does 
not exist")
+  return()
 endif()
 
 if (EXISTS ${foobar_pch_header})
-   set(RunCMake_TEST_FAILED "Generated foobar pch header ${foobar_pch_header} 
should not exist")
-   return()
+  set(RunCMake_TEST_FAILED "Generated foobar pch header ${foobar_pch_header} 
should not exist")
+  return()
 endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake 
b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
index 5a304f5..44fe2da 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
@@ -1,17 +1,17 @@
 if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
-    set(foobar_pch_h_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h")
-    set(foobar_pch_hxx_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.hxx")
+  set(foobar_pch_h_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h")
+  set(foobar_pch_hxx_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.hxx")
 else()
-    set(foobar_pch_h_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h")
-    set(foobar_pch_hxx_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx")
+  set(foobar_pch_h_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h")
+  set(foobar_pch_hxx_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx")
 endif()
 
 if (NOT EXISTS ${foobar_pch_h_header})
-   set(RunCMake_TEST_FAILED "Generated foobar C pch header 
${foobar_pch_h_header} does not exist")
-   return()
+  set(RunCMake_TEST_FAILED "Generated foobar C pch header 
${foobar_pch_h_header} does not exist")
+  return()
 endif()
 
 if (NOT EXISTS ${foobar_pch_hxx_header})
-   set(RunCMake_TEST_FAILED "Generated foobar C++ pch header 
${foobar_pch_hxx_header} does not exist")
-   return()
+  set(RunCMake_TEST_FAILED "Generated foobar C++ pch header 
${foobar_pch_hxx_header} does not exist")
+  return()
 endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake 
b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
index 4face95..7a837da 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
@@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.15)
 project(PchMultilanguage C CXX)
 
 add_executable(foobar
-    foo.c
-    main.cpp
+  foo.c
+  main.cpp
 )
 target_include_directories(foobar PUBLIC include)
 target_precompile_headers(foobar PRIVATE "<stddef.h>")
diff --git a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake 
b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake
index fd82607..ba220f3 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchPrologueEpilogue-check.cmake
@@ -1,7 +1,7 @@
 if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
-    set(main_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/CMakeFiles/main.dir/cmake_pch.hxx")
+  set(main_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/CMakeFiles/main.dir/cmake_pch.hxx")
 else()
-    set(main_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/cmake_pch.hxx")
+  set(main_pch_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/main.dir/cmake_pch.hxx")
 endif()
 
 file(STRINGS ${main_pch_header} main_pch_header_strings)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1144a4fa47d467ac3bd2f70ed2dffd04734d53a7
commit 1144a4fa47d467ac3bd2f70ed2dffd04734d53a7
Author:     Cristian Adam <cristian.a...@gmail.com>
AuthorDate: Thu Oct 3 21:53:42 2019 +0200
Commit:     Cristian Adam <cristian.a...@gmail.com>
CommitDate: Thu Oct 3 22:58:55 2019 +0200

    PCH: Add multi-language PCH generation support
    
    If the target has C files, it will get a C PCH file.
    The same for C++ files. The linker language is no
    longer used to determine which language to use for
    PCH.
    
    Fixes: #19790

diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 154d509..ae5139a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2254,185 +2254,200 @@ void cmLocalGenerator::AppendFlagEscape(std::string& 
flags,
 void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target,
                                           const std::string& config)
 {
-  const std::string lang = target->GetLinkerLanguage(config);
   const std::string buildType = cmSystemTools::UpperCase(config);
-  const std::string pchSource = target->GetPchSource(config, lang);
-  const std::string pchHeader = target->GetPchHeader(config, lang);
 
-  if (pchSource.empty() || pchHeader.empty()) {
-    return;
-  }
+  std::vector<cmSourceFile*> sources;
+  target->GetSourceFiles(sources, buildType);
 
-  const std::string createOptVar =
-    cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_CREATE_PCH");
-  std::string createOptionList =
-    this->Makefile->GetSafeDefinition(createOptVar);
+  for (const std::string& lang : { "C", "CXX" }) {
+    auto langSources =
+      std::count_if(sources.begin(), sources.end(), [lang](cmSourceFile* sf) {
+        return lang == sf->GetLanguage();
+      });
+    if (langSources == 0) {
+      continue;
+    }
 
-  const std::string useOptVar =
-    cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_USE_PCH");
-  std::string useOptionList = this->Makefile->GetSafeDefinition(useOptVar);
+    const std::string pchSource = target->GetPchSource(config, lang);
+    const std::string pchHeader = target->GetPchHeader(config, lang);
 
-  const std::string pchExtension =
-    this->Makefile->GetSafeDefinition("CMAKE_PCH_EXTENSION");
+    if (pchSource.empty() || pchHeader.empty()) {
+      continue;
+    }
 
-  if (createOptionList.empty() || useOptionList.empty() ||
-      pchExtension.empty()) {
-    return;
-  }
+    const std::string createOptVar =
+      cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_CREATE_PCH");
+    std::string createOptionList =
+      this->Makefile->GetSafeDefinition(createOptVar);
 
-  const char* pchReuseFrom =
-    target->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
+    const std::string useOptVar =
+      cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_USE_PCH");
+    std::string useOptionList = this->Makefile->GetSafeDefinition(useOptVar);
 
-  auto pch_sf = this->Makefile->GetOrCreateSource(
-    pchSource, false, cmSourceFileLocationKind::Known);
-  std::string pchFile = pchHeader;
+    const std::string pchExtension =
+      this->Makefile->GetSafeDefinition("CMAKE_PCH_EXTENSION");
 
-  if (!this->GetGlobalGenerator()->IsXcode()) {
-    if (!pchReuseFrom) {
-      target->AddSource(pchSource, true);
+    if (createOptionList.empty() || useOptionList.empty() ||
+        pchExtension.empty()) {
+      continue;
     }
 
-    // Exclude the pch files from linking
-    if (this->Makefile->IsOn("CMAKE_LINK_PCH")) {
+    const char* pchReuseFrom =
+      target->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM");
 
-      auto replaceExtension = [](const std::string& str,
-                                 const std::string& ext) -> std::string {
-        auto dot_pos = str.rfind('.');
-        std::string result;
-        if (dot_pos != std::string::npos) {
-          result = str.substr(0, dot_pos);
-        }
-        result += ext;
-        return result;
-      };
+    auto pch_sf = this->Makefile->GetOrCreateSource(
+      pchSource, false, cmSourceFileLocationKind::Known);
+    std::string pchFile = pchHeader;
 
+    if (!this->GetGlobalGenerator()->IsXcode()) {
       if (!pchReuseFrom) {
-        std::string pchSourceObj = target->GetPchFileObject(config, lang);
+        target->AddSource(pchSource, true);
+      }
 
-        pchFile = replaceExtension(pchSourceObj, pchExtension);
-        pch_sf->SetProperty("OBJECT_OUTPUTS", pchFile.c_str());
-      } else {
-        auto reuseTarget =
-          this->GlobalGenerator->FindGeneratorTarget(pchReuseFrom);
+      // Exclude the pch files from linking
+      if (this->Makefile->IsOn("CMAKE_LINK_PCH")) {
 
-        if (this->Makefile->IsOn("CMAKE_PCH_COPY_COMPILE_PDB")) {
+        auto replaceExtension = [](const std::string& str,
+                                   const std::string& ext) -> std::string {
+          auto dot_pos = str.rfind('.');
+          std::string result;
+          if (dot_pos != std::string::npos) {
+            result = str.substr(0, dot_pos);
+          }
+          result += ext;
+          return result;
+        };
 
-          const std::string pdb_prefix =
-            this->GetGlobalGenerator()->IsMultiConfig()
-            ? cmStrCat(this->GlobalGenerator->GetCMakeCFGIntDir(), "/")
-            : "";
+        if (!pchReuseFrom) {
+          std::string pchSourceObj = target->GetPchFileObject(config, lang);
 
-          const std::string target_compile_pdb_dir =
-            cmStrCat(target->GetLocalGenerator()->GetCurrentBinaryDirectory(),
-                     "/", target->GetName(), ".dir/");
+          pchFile = replaceExtension(pchSourceObj, pchExtension);
+          pch_sf->SetProperty("OBJECT_OUTPUTS", pchFile.c_str());
+        } else {
+          auto reuseTarget =
+            this->GlobalGenerator->FindGeneratorTarget(pchReuseFrom);
 
-          const std::string copy_script =
-            cmStrCat(target_compile_pdb_dir, "copy_idb_pdb.cmake");
-          cmGeneratedFileStream file(copy_script);
+          if (this->Makefile->IsOn("CMAKE_PCH_COPY_COMPILE_PDB")) {
 
-          file << "# CMake generated file\n";
-          for (auto extension : { ".pdb", ".idb" }) {
-            const std::string from_file = cmStrCat(
-              reuseTarget->GetLocalGenerator()->GetCurrentBinaryDirectory(),
-              "/", pchReuseFrom, ".dir/${PDB_PREFIX}", pchReuseFrom,
-              extension);
+            const std::string pdb_prefix =
+              this->GetGlobalGenerator()->IsMultiConfig()
+              ? cmStrCat(this->GlobalGenerator->GetCMakeCFGIntDir(), "/")
+              : "";
 
-            const std::string to_dir = cmStrCat(
+            const std::string target_compile_pdb_dir = cmStrCat(
               target->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/",
-              target->GetName(), ".dir/${PDB_PREFIX}");
-
-            file << "if (EXISTS \"" << from_file << "\")\n";
-            file << "  file(COPY \"" << from_file << "\""
-                 << " DESTINATION \"" << to_dir << "\")\n";
-            file << "endif()\n";
-          }
+              target->GetName(), ".dir/");
+
+            const std::string copy_script =
+              cmStrCat(target_compile_pdb_dir, "copy_idb_pdb.cmake");
+            cmGeneratedFileStream file(copy_script);
+
+            file << "# CMake generated file\n";
+            for (auto extension : { ".pdb", ".idb" }) {
+              const std::string from_file = cmStrCat(
+                reuseTarget->GetLocalGenerator()->GetCurrentBinaryDirectory(),
+                "/", pchReuseFrom, ".dir/${PDB_PREFIX}", pchReuseFrom,
+                extension);
+
+              const std::string to_dir = cmStrCat(
+                target->GetLocalGenerator()->GetCurrentBinaryDirectory(), "/",
+                target->GetName(), ".dir/${PDB_PREFIX}");
+
+              file << "if (EXISTS \"" << from_file << "\")\n";
+              file << "  file(COPY \"" << from_file << "\""
+                   << " DESTINATION \"" << to_dir << "\")\n";
+              file << "endif()\n";
+            }
 
-          cmCustomCommandLines commandLines;
-          cmCustomCommandLine currentLine;
-          currentLine.push_back(cmSystemTools::GetCMakeCommand());
-          currentLine.push_back(cmStrCat("-DPDB_PREFIX=", pdb_prefix));
-          currentLine.push_back("-P");
-          currentLine.push_back(copy_script);
-          commandLines.push_back(std::move(currentLine));
-
-          const std::string no_main_dependency;
-          const std::vector<std::string> no_deps;
-          const char* no_message = "";
-          const char* no_current_dir = nullptr;
-          std::vector<std::string> no_byproducts;
-
-          std::vector<std::string> outputs;
-          outputs.push_back(cmStrCat(target_compile_pdb_dir, pdb_prefix,
-                                     pchReuseFrom, ".pdb"));
-
-          if (this->GetGlobalGenerator()->IsMultiConfig()) {
-            this->Makefile->AddCustomCommandToTarget(
-              target->GetName(), outputs, no_deps, commandLines,
-              cmCustomCommandType::PRE_BUILD, no_message, no_current_dir);
-          } else {
-            cmImplicitDependsList no_implicit_depends;
-            cmSourceFile* copy_rule = this->Makefile->AddCustomCommandToOutput(
-              outputs, no_byproducts, no_deps, no_main_dependency,
-              no_implicit_depends, commandLines, no_message, no_current_dir);
-
-            if (copy_rule) {
-              target->AddSource(copy_rule->ResolveFullPath());
+            cmCustomCommandLines commandLines;
+            cmCustomCommandLine currentLine;
+            currentLine.push_back(cmSystemTools::GetCMakeCommand());
+            currentLine.push_back(cmStrCat("-DPDB_PREFIX=", pdb_prefix));
+            currentLine.push_back("-P");
+            currentLine.push_back(copy_script);
+            commandLines.push_back(std::move(currentLine));
+
+            const std::string no_main_dependency;
+            const std::vector<std::string> no_deps;
+            const char* no_message = "";
+            const char* no_current_dir = nullptr;
+            std::vector<std::string> no_byproducts;
+
+            std::vector<std::string> outputs;
+            outputs.push_back(cmStrCat(target_compile_pdb_dir, pdb_prefix,
+                                       pchReuseFrom, ".pdb"));
+
+            if (this->GetGlobalGenerator()->IsMultiConfig()) {
+              this->Makefile->AddCustomCommandToTarget(
+                target->GetName(), outputs, no_deps, commandLines,
+                cmCustomCommandType::PRE_BUILD, no_message, no_current_dir);
+            } else {
+              cmImplicitDependsList no_implicit_depends;
+              cmSourceFile* copy_rule =
+                this->Makefile->AddCustomCommandToOutput(
+                  outputs, no_byproducts, no_deps, no_main_dependency,
+                  no_implicit_depends, commandLines, no_message,
+                  no_current_dir);
+
+              if (copy_rule) {
+                target->AddSource(copy_rule->ResolveFullPath());
+              }
             }
-          }
 
-          target->Target->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
-                                      target_compile_pdb_dir.c_str());
-        }
+            target->Target->SetProperty("COMPILE_PDB_OUTPUT_DIRECTORY",
+                                        target_compile_pdb_dir.c_str());
+          }
 
-        std::string pchSourceObj = reuseTarget->GetPchFileObject(config, lang);
+          std::string pchSourceObj =
+            reuseTarget->GetPchFileObject(config, lang);
 
-        // Link to the pch object file
-        target->Target->SetProperty(
-          "LINK_FLAGS",
-          this->ConvertToOutputFormat(pchSourceObj, SHELL).c_str());
+          // Link to the pch object file
+          target->Target->SetProperty(
+            "LINK_FLAGS",
+            this->ConvertToOutputFormat(pchSourceObj, SHELL).c_str());
 
-        pchFile = replaceExtension(pchSourceObj, pchExtension);
+          pchFile = replaceExtension(pchSourceObj, pchExtension);
+        }
+      } else {
+        pchFile += pchExtension;
+        pch_sf->SetProperty("PCH_EXTENSION", pchExtension.c_str());
       }
-    } else {
-      pchFile += pchExtension;
-      pch_sf->SetProperty("PCH_EXTENSION", pchExtension.c_str());
-    }
-
-    // Add pchHeader to source files, which will
-    // be grouped as "Precompile Header File"
-    auto pchHeader_sf = this->Makefile->GetOrCreateSource(
-      pchHeader, false, cmSourceFileLocationKind::Known);
-    std::string err;
-    pchHeader_sf->ResolveFullPath(&err);
-    target->AddSource(pchHeader);
 
-    for (auto& str : { std::ref(useOptionList), std::ref(createOptionList) }) {
-      cmSystemTools::ReplaceString(str, "<PCH_HEADER>", pchHeader);
-      cmSystemTools::ReplaceString(str, "<PCH_FILE>", pchFile);
+      // Add pchHeader to source files, which will
+      // be grouped as "Precompile Header File"
+      auto pchHeader_sf = this->Makefile->GetOrCreateSource(
+        pchHeader, false, cmSourceFileLocationKind::Known);
+      std::string err;
+      pchHeader_sf->ResolveFullPath(&err);
+      target->AddSource(pchHeader);
+
+      for (auto& str :
+           { std::ref(useOptionList), std::ref(createOptionList) }) {
+        cmSystemTools::ReplaceString(str, "<PCH_HEADER>", pchHeader);
+        cmSystemTools::ReplaceString(str, "<PCH_FILE>", pchFile);
+      }
     }
-  }
 
-  pch_sf->SetProperty("COMPILE_OPTIONS", createOptionList.c_str());
+    pch_sf->SetProperty("COMPILE_OPTIONS", createOptionList.c_str());
 
-  std::vector<cmSourceFile*> sources;
-  target->GetSourceFiles(sources, buildType);
-  for (cmSourceFile* sf : sources) {
-    if (pch_sf == sf || sf->GetLanguage() != lang) {
-      continue;
-    }
+    for (cmSourceFile* sf : sources) {
+      if (pch_sf == sf || sf->GetLanguage() != lang) {
+        continue;
+      }
 
-    if (sf->GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS")) {
-      if (this->GetGlobalGenerator()->IsXcode()) {
-        sf->SetProperty("COMPILE_DEFINITIONS",
-                        "CMAKE_SKIP_PRECOMPILE_HEADERS");
+      if (sf->GetPropertyAsBool("SKIP_PRECOMPILE_HEADERS")) {
+        if (this->GetGlobalGenerator()->IsXcode()) {
+          sf->SetProperty("COMPILE_DEFINITIONS",
+                          "CMAKE_SKIP_PRECOMPILE_HEADERS");
+        }
+        continue;
       }
-      continue;
-    }
 
-    if (!this->GetGlobalGenerator()->IsXcode()) {
-      sf->AppendProperty("OBJECT_DEPENDS", pchFile.c_str());
-      sf->AppendProperty("OBJECT_DEPENDS", pchHeader.c_str());
-      sf->SetProperty("COMPILE_OPTIONS", useOptionList.c_str());
+      if (!this->GetGlobalGenerator()->IsXcode()) {
+        sf->AppendProperty("OBJECT_DEPENDS", pchFile.c_str());
+        sf->AppendProperty("OBJECT_DEPENDS", pchHeader.c_str());
+        sf->SetProperty("COMPILE_OPTIONS", useOptionList.c_str());
+      }
     }
   }
 }
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake 
b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
new file mode 100644
index 0000000..5a304f5
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
@@ -0,0 +1,17 @@
+if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
+    set(foobar_pch_h_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.h")
+    set(foobar_pch_hxx_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/CMakeFiles/foobar.dir/cmake_pch.hxx")
+else()
+    set(foobar_pch_h_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.h")
+    set(foobar_pch_hxx_header 
"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/foobar.dir/cmake_pch.hxx")
+endif()
+
+if (NOT EXISTS ${foobar_pch_h_header})
+   set(RunCMake_TEST_FAILED "Generated foobar C pch header 
${foobar_pch_h_header} does not exist")
+   return()
+endif()
+
+if (NOT EXISTS ${foobar_pch_hxx_header})
+   set(RunCMake_TEST_FAILED "Generated foobar C++ pch header 
${foobar_pch_hxx_header} does not exist")
+   return()
+endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake 
b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
new file mode 100644
index 0000000..4face95
--- /dev/null
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 3.15)
+project(PchMultilanguage C CXX)
+
+add_executable(foobar
+    foo.c
+    main.cpp
+)
+target_include_directories(foobar PUBLIC include)
+target_precompile_headers(foobar PRIVATE "<stddef.h>")
diff --git a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake 
b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
index bd3b1b8..ec13663 100644
--- a/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/RunCMakeTest.cmake
@@ -18,3 +18,4 @@ run_cmake(PchPrologueEpilogue)
 run_test(SkipPrecompileHeaders)
 run_test(PchReuseFrom)
 run_test(PchReuseFromSubdir)
+run_cmake(PchMultilanguage)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83c1657ff7fda3dc86b49bc9039f59449f2d8ae4
commit 83c1657ff7fda3dc86b49bc9039f59449f2d8ae4
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Thu Oct 3 13:34:42 2019 -0400
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Thu Oct 3 14:55:22 2019 -0400

    Unity build: Generate sources during Compute step
    
    The unity build sources need to be added for all generators.  Create
    them during `cmGlobalGenerator::Compute` to avoid duplicating the calls
    in every generator.  We already handle Qt autogen there too.
    
    Issue: #19789

diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 018037c..ee9ea3c 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1381,6 +1381,11 @@ bool cmGlobalGenerator::Compute()
     return false;
   }
 
+  // Add automatically generated sources (e.g. unity build).
+  if (!this->AddAutomaticSources()) {
+    return false;
+  }
+
   // Add generator specific helper commands
   for (cmLocalGenerator* localGen : this->LocalGenerators) {
     localGen->AddHelperCommands();
@@ -1548,6 +1553,19 @@ bool cmGlobalGenerator::QtAutoGen()
 #endif
 }
 
+bool cmGlobalGenerator::AddAutomaticSources()
+{
+  for (cmLocalGenerator* lg : this->LocalGenerators) {
+    for (cmGeneratorTarget* gt : lg->GetGeneratorTargets()) {
+      if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
+        continue;
+      }
+      lg->AddUnityBuild(gt);
+    }
+  }
+  return true;
+}
+
 cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer(
   cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) const
 {
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index b7a8ac7..9e30b8f 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -503,6 +503,8 @@ protected:
   /// @return true on success
   bool QtAutoGen();
 
+  bool AddAutomaticSources();
+
   std::string SelectMakeProgram(const std::string& makeProgram,
                                 const std::string& makeDefault = "") const;
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index f23e28d..8ae1e12 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2827,7 +2827,6 @@ bool cmGlobalXCodeGenerator::CreateGroups(
         continue;
       }
 
-      generator->AddUnityBuild(gtgt, "");
       generator->AddPchDependencies(gtgt, "");
 
       auto addSourceToGroup = [this, mf, gtgt,
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 154d509..fc1426d 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2437,13 +2437,18 @@ void 
cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target,
   }
 }
 
-void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target,
-                                     const std::string& config)
+void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target)
 {
   if (!target->GetPropertyAsBool("UNITY_BUILD")) {
     return;
   }
 
+  // FIXME: Handle all configurations in multi-config generators.
+  std::string config;
+  if (!this->GetGlobalGenerator()->IsMultiConfig()) {
+    config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
+  }
+
   const std::string buildType = cmSystemTools::UpperCase(config);
 
   std::string filename_base =
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index f150733..14d05ad 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -128,7 +128,7 @@ public:
                                 const std::string& rawFlag) const;
   void AddPchDependencies(cmGeneratorTarget* target,
                           const std::string& config);
-  void AddUnityBuild(cmGeneratorTarget* target, const std::string& config);
+  void AddUnityBuild(cmGeneratorTarget* target);
   void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target,
                             const std::string& config,
                             const std::string& lang);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx 
b/Source/cmLocalVisualStudio7Generator.cxx
index 6b0f802..e16e851 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1313,7 +1313,6 @@ void 
cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
                                                     const std::string& libName,
                                                     cmGeneratorTarget* target)
 {
-  this->AddUnityBuild(target, "");
   this->AddPchDependencies(target, "");
 
   std::vector<std::string> configs;
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx 
b/Source/cmMakefileExecutableTargetGenerator.cxx
index 91bd47e..0b225cb 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -41,7 +41,6 @@ 
cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator(
     cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
   this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
 
-  this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
   this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
 }
 
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx 
b/Source/cmMakefileLibraryTargetGenerator.cxx
index faa0d67..cf09374 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -43,7 +43,6 @@ 
cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
     cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
   this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
 
-  this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
   this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
 }
 
diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx 
b/Source/cmMakefileUtilityTargetGenerator.cxx
index 47e2665..516f098 100644
--- a/Source/cmMakefileUtilityTargetGenerator.cxx
+++ b/Source/cmMakefileUtilityTargetGenerator.cxx
@@ -26,7 +26,6 @@ 
cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator(
     cm::make_unique<cmOSXBundleGenerator>(target, this->ConfigName);
   this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
 
-  this->LocalGenerator->AddUnityBuild(target, this->ConfigName);
   this->LocalGenerator->AddPchDependencies(target, this->ConfigName);
 }
 
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx 
b/Source/cmNinjaNormalTargetGenerator.cxx
index 38ccaa3..3f362fc 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -62,7 +62,6 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
     cm::make_unique<cmOSXBundleGenerator>(target, this->GetConfigName());
   this->OSXBundleGenerator->SetMacContentFolders(&this->MacContentFolders);
 
-  GetLocalGenerator()->AddUnityBuild(target, this->GetConfigName());
   GetLocalGenerator()->AddPchDependencies(target, this->GetConfigName());
 }
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index d5f0c61..34556f9 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -251,7 +251,6 @@ 
cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
   this->InSourceBuild = (this->Makefile->GetCurrentSourceDirectory() ==
                          this->Makefile->GetCurrentBinaryDirectory());
 
-  this->LocalGenerator->AddUnityBuild(target, "");
   this->LocalGenerator->AddPchDependencies(target, "");
 }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bc4f8f4472ae94b7053ee373a7406774900f350c
commit bc4f8f4472ae94b7053ee373a7406774900f350c
Author:     Cristian Adam <cristian.a...@gmail.com>
AuthorDate: Thu Oct 3 14:43:00 2019 +0200
Commit:     Cristian Adam <cristian.a...@gmail.com>
CommitDate: Thu Oct 3 14:43:00 2019 +0200

    PCH: Use clang's own pch functionality instead of the GCC emulation
    
    Fixes: #19786

diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake
index 45c33fb..ea5a3b3 100644
--- a/Modules/Compiler/Clang.cmake
+++ b/Modules/Compiler/Clang.cmake
@@ -97,6 +97,9 @@ else()
       "\"${__ranlib}\" <TARGET>"
     )
 
+    set(CMAKE_PCH_EXTENSION .pch)
     set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
+    set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang 
<PCH_FILE>)
+    set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang 
-include -Xclang <PCH_HEADER>)
   endmacro()
 endif()
diff --git a/Modules/Platform/Windows-Clang.cmake 
b/Modules/Platform/Windows-Clang.cmake
index 84b3a9b..f226553 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -83,9 +83,10 @@ macro(__windows_compiler_clang_gnu lang)
   string(APPEND CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG 
-Xclang -gcodeview ${__ADDED_FLAGS}")
   set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
 
-  set(CMAKE_PCH_EXTENSION .gch)
-  set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -include 
<PCH_HEADER>)
-  set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Winvalid-pch -x 
${__pch_header_${lang}} -include <PCH_HEADER>)
+  set(CMAKE_PCH_EXTENSION .pch)
+  set(CMAKE_PCH_PROLOGUE "#pragma clang system_header")
+  set(CMAKE_${lang}_COMPILE_OPTIONS_USE_PCH -Xclang -include-pch -Xclang 
<PCH_FILE>)
+  set(CMAKE_${lang}_COMPILE_OPTIONS_CREATE_PCH -Xclang -emit-pch -Xclang 
-include -Xclang <PCH_HEADER>)
 
   unset(__ADDED_FLAGS)
   unset(__ADDED_FLAGS_DEBUG)

-----------------------------------------------------------------------

Summary of changes:
 Modules/Compiler/Clang.cmake                       |   3 +
 Modules/Platform/Windows-Clang.cmake               |   7 +-
 Source/cmGlobalGenerator.cxx                       |  18 ++
 Source/cmGlobalGenerator.h                         |   2 +
 Source/cmGlobalXCodeGenerator.cxx                  |   1 -
 Source/cmLocalGenerator.cxx                        | 310 +++++++++++----------
 Source/cmLocalGenerator.h                          |   2 +-
 Source/cmLocalVisualStudio7Generator.cxx           |   1 -
 Source/cmMakefileExecutableTargetGenerator.cxx     |   1 -
 Source/cmMakefileLibraryTargetGenerator.cxx        |   1 -
 Source/cmMakefileUtilityTargetGenerator.cxx        |   1 -
 Source/cmNinjaNormalTargetGenerator.cxx            |   1 -
 Source/cmVisualStudio10TargetGenerator.cxx         |   1 -
 .../PrecompileHeaders/DisabledPch-check.cmake      |  16 +-
 .../PrecompileHeaders/PchMultilanguage-check.cmake |  17 ++
 .../PrecompileHeaders/PchMultilanguage.cmake       |   9 +
 .../PchPrologueEpilogue-check.cmake                |   4 +-
 .../RunCMake/PrecompileHeaders/RunCMakeTest.cmake  |   1 +
 18 files changed, 230 insertions(+), 166 deletions(-)
 create mode 100644 
Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
 create mode 100644 Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to