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 1f0a695561f12b8e3929066d7dc61535a20af66c (commit) via bae7a2e25074145a8b57baa96624f0b87428840d (commit) via 050bf5747287f9c00be5e2659d93c2b164d0dcec (commit) via 0302d40faa572aeca1769969550730cd9b283b1b (commit) via 730d8a135e140f0e7860021b7989954a893798d4 (commit) via d156f8f5a2702aa64b74fa01f48b38c7078054d1 (commit) via 62dbe53a8a2809c0c38386e5880acb446feacf28 (commit) via 1ebb0d79fe1330eea4b044bcfd9b613db8bfe86b (commit) via 054954d855fea6f4dd31fbd78c5e0cab0635396e (commit) via 30a550d6ade191e6510fb74a73fe34f1615b6086 (commit) via 0024356f8e8e5f9ec2fa6af1e651c634eba3b22b (commit) via b133d14fb1c0183c647136188cf4fff0ed05c58e (commit) via 8cc04b1918301964ef7de0f44b77fdf1d82729ba (commit) via cdff7f4e2a255e083e5a19ac541b4de2874785af (commit) via 8691b3cf914c97ed9e3612009707bc5a791ef4f0 (commit) via 47da9859e8b5e938fa40b69d117aecef82e090a9 (commit) via 990270213408bb4d11fa620ba9c96b25da313945 (commit) via 12aa6fe07bc2f3903386fb1f57ace6601ec91100 (commit) via 02293841e742c14a18155bc0e10c39462c97dcbf (commit) via a173a1173e06dad812afe17c9751cb7c2f94eda4 (commit) from e0ab9e1cb9b07a1a320db6a788442cd9bc2a98c6 (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=1f0a695561f12b8e3929066d7dc61535a20af66c commit 1f0a695561f12b8e3929066d7dc61535a20af66c Merge: bae7a2e cdff7f4 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 14 14:54:08 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 14 10:58:43 2019 -0400 Merge topic 'cmSytemTools_ExpandedList' cdff7f4e2a cmSystemTools: Add ExpandedListArgument and ExpandedLists methods Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Ben Boeckel <ben.boec...@kitware.com> Merge-request: !3313 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bae7a2e25074145a8b57baa96624f0b87428840d commit bae7a2e25074145a8b57baa96624f0b87428840d Merge: 050bf57 8cc04b1 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 14 14:53:28 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 14 10:57:44 2019 -0400 Merge topic 'error-generate-step' 8cc04b1918 cmake: Display error if generate step fails Acked-by: Kitware Robot <kwro...@kitware.com> Acked-by: Ben Boeckel <ben.boec...@kitware.com> Merge-request: !3304 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=050bf5747287f9c00be5e2659d93c2b164d0dcec commit 050bf5747287f9c00be5e2659d93c2b164d0dcec Merge: 0302d40 054954d Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 14 14:54:01 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 14 10:56:29 2019 -0400 Merge topic 'ninja_cleanups' 054954d855 Ninja: Use clean target instead of clean tool in `cmake --target clean` calls 30a550d6ad Ninja: In cmNinjaTargetGenerator use std::unique_ptr to manage new instances 0024356f8e Ninja: In cmNinjaTargetGenerator optimize string composition 8691b3cf91 Ninja: Inline range loop range arguments 47da9859e8 Ninja: In cmGlobalNinjaGenerator use std::unique_ptr to manage output streams 9902702134 Ninja: Add and use cmGlobalNinjaGenerator::CMakeCmd method 12aa6fe07b Ninja: Fix message in cmGlobalNinjaGenerator::WriteBuild method 02293841e7 Ninja: Simplify cmGlobalNinjaGenerator::AddRule and HasRule methods ... Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3312 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0302d40faa572aeca1769969550730cd9b283b1b commit 0302d40faa572aeca1769969550730cd9b283b1b Merge: 730d8a1 b133d14 Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 14 14:53:18 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 14 10:54:53 2019 -0400 Merge topic 'cminstallgenerator-compute-error' b133d14fb1 Refactor: Allow cmInstallGenerator::Compute() to return an error Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3305 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=730d8a135e140f0e7860021b7989954a893798d4 commit 730d8a135e140f0e7860021b7989954a893798d4 Merge: e0ab9e1 d156f8f Author: Brad King <brad.k...@kitware.com> AuthorDate: Tue May 14 14:52:33 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Tue May 14 10:53:24 2019 -0400 Merge topic 'relax_cxx_relaxed_constexpr_requirements' d156f8f5a2 CompileFeatures: Record when MSVC gained full CXX14 support 62dbe53a8a CompileFeatures: Record when Intel gained full CXX14 support 1ebb0d79fe CompileFeatures: Relax cxx_relaxed_constexpr compiler requirements Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3292 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d156f8f5a2702aa64b74fa01f48b38c7078054d1 commit d156f8f5a2702aa64b74fa01f48b38c7078054d1 Author: Robert Maynard <robert.mayn...@kitware.com> AuthorDate: Tue May 7 13:26:34 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon May 13 13:13:09 2019 -0400 CompileFeatures: Record when MSVC gained full CXX14 support Use the infrastructure added by commit 646fb1a646 (CompileFeatures: memoize C++ compilers with full language level support, 2019-03-27) to avoid using a `try_compile` to check for C++14 feature support when the running compiler is known to have all features. diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index 787c17e..f3a7408 100644 --- a/Modules/Compiler/MSVC-CXX.cmake +++ b/Modules/Compiler/MSVC-CXX.cmake @@ -18,6 +18,7 @@ if ((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0.24215.1 AND set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std:c++14") if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.11.25505) set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std:c++17") set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std:c++17") else() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=62dbe53a8a2809c0c38386e5880acb446feacf28 commit 62dbe53a8a2809c0c38386e5880acb446feacf28 Author: Robert Maynard <robert.mayn...@kitware.com> AuthorDate: Thu May 9 10:55:55 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon May 13 13:12:47 2019 -0400 CompileFeatures: Record when Intel gained full CXX14 support Use the infrastructure added by commit 646fb1a646 (CompileFeatures: memoize C++ compilers with full language level support, 2019-03-27) to avoid using a `try_compile` to check for C++14 feature support when the running compiler is known to have all features. diff --git a/Modules/Compiler/Intel-CXX.cmake b/Modules/Compiler/Intel-CXX.cmake index 44b0c3d..b630a6b 100644 --- a/Modules/Compiler/Intel-CXX.cmake +++ b/Modules/Compiler/Intel-CXX.cmake @@ -40,13 +40,7 @@ else() set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17") endif() - # While full C++14 support was first introduced in Intel 17, - # Intel 18.0.0-4 don't have full support as they broke - # support for cxx_relaxed_constexpr. - if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 18.0.4) - set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) - elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0.0 - AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.0) + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17.0) set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1ebb0d79fe1330eea4b044bcfd9b613db8bfe86b commit 1ebb0d79fe1330eea4b044bcfd9b613db8bfe86b Author: Robert Maynard <robert.mayn...@kitware.com> AuthorDate: Tue May 7 13:20:21 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon May 13 13:11:32 2019 -0400 CompileFeatures: Relax cxx_relaxed_constexpr compiler requirements This in effect means that cxx_relaxed_constexpr is now supported by MSVC and Intel 18.0-18.04. diff --git a/Modules/Compiler/Intel-CXX-FeatureTests.cmake b/Modules/Compiler/Intel-CXX-FeatureTests.cmake index aa35b97..bbefe15 100644 --- a/Modules/Compiler/Intel-CXX-FeatureTests.cmake +++ b/Modules/Compiler/Intel-CXX-FeatureTests.cmake @@ -24,7 +24,7 @@ set(DETECT_CXX14 "((__cplusplus >= 201300L) || ((__cplusplus == 201103L) && !def unset(DETECT_BUGGY_ICC15) set(Intel17_CXX14 "__INTEL_COMPILER >= 1700 && ${DETECT_CXX14}") -set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && !(__INTEL_COMPILER == 1800 && __INTEL_COMPILER_UPDATE < 5) && !defined(_MSC_VER))") +set(_cmake_feature_test_cxx_relaxed_constexpr "__cpp_constexpr >= 201304 || (${Intel17_CXX14} && !defined(_MSC_VER))") set(Intel16_CXX14 "__INTEL_COMPILER >= 1600 && ${DETECT_CXX14}") set(_cmake_feature_test_cxx_aggregate_default_initializers "${Intel16_CXX14}") diff --git a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake index 9c604f2..125974a 100644 --- a/Modules/Compiler/MSVC-CXX-FeatureTests.cmake +++ b/Modules/Compiler/MSVC-CXX-FeatureTests.cmake @@ -9,10 +9,8 @@ set(_cmake_oldestSupported "_MSC_VER >= 1600") # https://docs.microsoft.com/en-us/cpp/cpp-conformance-improvements-2017#update_153 set(_cmake_feature_test_cxx_decltype_incomplete_return_types "_MSC_VER >= 1911") -set(MSVC_2017 "_MSC_VER >= 1910") -# VS 2017 introduces support for "N3652 Extended constexpr" -# but as of v15.6 there are still bugs in the implementation -#set(_cmake_feature_test_cxx_relaxed_constexpr "${MSVC_2017}") +# VS 2017 v15.3 fixes support for "N3652 Extended constexpr" +set(_cmake_feature_test_cxx_relaxed_constexpr "_MSC_VER >= 1911") # VS 2017 Preview introduces support for aggregate initializers. set(_cmake_feature_test_cxx_aggregate_default_initializers "_MSC_FULL_VER >= 190024406") diff --git a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp index 7b3602c..953148d 100644 --- a/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp +++ b/Tests/CompileFeatures/cxx_relaxed_constexpr.cpp @@ -22,6 +22,7 @@ constexpr int g(const int (&is)[4]) int someFunc() { - constexpr int k3 = g({ 4, 5, 6, 7 }); + constexpr int values[4] = { 4, 5, 6, 7 }; + constexpr int k3 = g(values); return k3 - 42; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=054954d855fea6f4dd31fbd78c5e0cab0635396e commit 054954d855fea6f4dd31fbd78c5e0cab0635396e Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Sat May 11 13:42:43 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Mon May 13 17:20:28 2019 +0200 Ninja: Use clean target instead of clean tool in `cmake --target clean` calls A convenience `clean` target for the Ninja generator exists since commit 3bd41f2eb5. It's safe to call `ninja clean` instead of `ninja -t clean`. This removes the exception mapping of the `clean` target in `cmake --build ... --target clean` calls to the Ninja `-t clean` tool. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 760a5ab..1b973e0 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -679,11 +679,7 @@ cmGlobalNinjaGenerator::GenerateBuildCommand( makeCommand.Add(makeOptions.begin(), makeOptions.end()); for (const auto& tname : targetNames) { if (!tname.empty()) { - if (tname == "clean") { - makeCommand.Add("-t", "clean"); - } else { - makeCommand.Add(tname); - } + makeCommand.Add(tname); } } return { std::move(makeCommand) }; diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index ce9d124..ffcea60 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -43,8 +43,6 @@ struct cmDocumentationEntry; * it is handle by Ninja's -v option. * - We don't care about computing any progress status since Ninja manages * it itself. - * - We don't care about generating a clean target since Ninja already have - * a clean tool. * - We generate one build.ninja and one rules.ninja per project. * - We try to minimize the number of generated rules: one per target and * language. https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30a550d6ade191e6510fb74a73fe34f1615b6086 commit 30a550d6ade191e6510fb74a73fe34f1615b6086 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 10 19:22:52 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Mon May 13 17:20:27 2019 +0200 Ninja: In cmNinjaTargetGenerator use std::unique_ptr to manage new instances diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 515651a..e6d4457 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -83,14 +83,13 @@ void cmLocalNinjaGenerator::Generate() if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(target); + auto tg = cmNinjaTargetGenerator::New(target); if (tg) { tg->Generate(); // Add the target to "all" if required. if (!this->GetGlobalNinjaGenerator()->IsExcluded(target)) { this->GetGlobalNinjaGenerator()->AddDependencyToAll(target); } - delete tg; } } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 9ab0947..506711a 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -33,7 +33,8 @@ #include "cmSystemTools.h" #include "cmake.h" -cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) +std::unique_ptr<cmNinjaTargetGenerator> cmNinjaTargetGenerator::New( + cmGeneratorTarget* target) { switch (target->GetType()) { case cmStateEnums::EXECUTABLE: @@ -41,14 +42,14 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) case cmStateEnums::STATIC_LIBRARY: case cmStateEnums::MODULE_LIBRARY: case cmStateEnums::OBJECT_LIBRARY: - return new cmNinjaNormalTargetGenerator(target); + return cm::make_unique<cmNinjaNormalTargetGenerator>(target); case cmStateEnums::UTILITY: case cmStateEnums::GLOBAL_TARGET: - return new cmNinjaUtilityTargetGenerator(target); + return cm::make_unique<cmNinjaUtilityTargetGenerator>(target); default: - return nullptr; + return std::unique_ptr<cmNinjaTargetGenerator>(); } } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 51c9ac7..3dbc1b5 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -11,6 +11,7 @@ #include "cmOSXBundleGenerator.h" #include <map> +#include <memory> // IWYU pragma: keep #include <set> #include <string> #include <vector> @@ -26,7 +27,8 @@ class cmNinjaTargetGenerator : public cmCommonTargetGenerator { public: /// Create a cmNinjaTargetGenerator according to the @a target's type. - static cmNinjaTargetGenerator* New(cmGeneratorTarget* target); + static std::unique_ptr<cmNinjaTargetGenerator> New( + cmGeneratorTarget* target); /// Build a NinjaTargetGenerator. cmNinjaTargetGenerator(cmGeneratorTarget* target); https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0024356f8e8e5f9ec2fa6af1e651c634eba3b22b commit 0024356f8e8e5f9ec2fa6af1e651c634eba3b22b Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Thu May 9 21:47:07 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Mon May 13 17:20:23 2019 +0200 Ninja: In cmNinjaTargetGenerator optimize string composition diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index ee10891..9ab0947 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -9,7 +9,7 @@ #include <iterator> #include <map> #include <memory> // IWYU pragma: keep -#include <sstream> +#include <ostream> #include <utility> #include "cmAlgorithms.h" @@ -496,12 +496,11 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) launcher += " "; } - if (explicitPP) { - // Lookup the explicit preprocessing rule. - std::string const ppVar = "CMAKE_" + lang + "_PREPROCESS_SOURCE"; - std::string const& ppCmd = - this->GetMakefile()->GetRequiredDefinition(ppVar); + std::string const cmakeCmd = + this->GetLocalGenerator()->ConvertToOutputFormat( + cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); + if (explicitPP) { // Explicit preprocessing always uses a depfile. std::string const ppDeptype; // no deps= for multiple outputs std::string const ppDepfile = "$DEP_FILE"; @@ -535,8 +534,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) std::string ppRspContent; if (!responseFlag.empty()) { ppRspFile = "$RSP_FILE"; - ppRspContent = std::string(" ") + ppVars.Defines + " " + - ppVars.Includes + " " + ppFlags; + ppRspContent = " "; + ppRspContent += ppVars.Defines; + ppRspContent += " "; + ppRspContent += ppVars.Includes; + ppRspContent += " "; + ppRspContent += ppFlags; ppFlags = responseFlag + ppRspFile; ppVars.Defines = ""; ppVars.Includes = ""; @@ -546,7 +549,13 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) // Rule for preprocessing source file. std::vector<std::string> ppCmds; - cmSystemTools::ExpandListArgument(ppCmd, ppCmds); + { + // Lookup the explicit preprocessing rule. + std::string ppVar = "CMAKE_" + lang; + ppVar += "_PREPROCESS_SOURCE"; + cmSystemTools::ExpandListArgument( + this->GetMakefile()->GetRequiredDefinition(ppVar), ppCmds); + } for (std::string& i : ppCmds) { i = launcher + i; @@ -555,67 +564,73 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) } // Run CMake dependency scanner on preprocessed output. - std::string const cmake = this->GetLocalGenerator()->ConvertToOutputFormat( - cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - ppCmds.push_back( - cmake + - " -E cmake_ninja_depends" - " --tdi=" + - tdi + " --lang=" + lang + - " --pp=$out" - " --dep=$DEP_FILE" + - (needDyndep ? " --obj=$OBJ_FILE --ddi=$DYNDEP_INTERMEDIATE_FILE" : "")); - + { + std::string ccmd = cmakeCmd; + ccmd += " -E cmake_ninja_depends --tdi="; + ccmd += tdi; + ccmd += " --lang="; + ccmd += lang; + ccmd += " --pp=$out --dep=$DEP_FILE"; + if (needDyndep) { + ccmd += " --obj=$OBJ_FILE --ddi=$DYNDEP_INTERMEDIATE_FILE"; + } + ppCmds.emplace_back(std::move(ccmd)); + } std::string const ppCmdLine = this->GetLocalGenerator()->BuildCommandLine(ppCmds); // Write the rule for preprocessing file of the given language. - std::ostringstream ppComment; - ppComment << "Rule for preprocessing " << lang << " files."; - std::ostringstream ppDesc; - ppDesc << "Building " << lang << " preprocessed $out"; + std::string ppComment = "Rule for preprocessing "; + ppComment += lang; + ppComment += " files."; + std::string ppDesc = "Building "; + ppDesc += lang; + ppDesc += " preprocessed $out"; this->GetGlobalGenerator()->AddRule( - this->LanguagePreprocessRule(lang), ppCmdLine, ppDesc.str(), - ppComment.str(), ppDepfile, ppDeptype, ppRspFile, ppRspContent, + this->LanguagePreprocessRule(lang), ppCmdLine, ppDesc, ppComment, + ppDepfile, ppDeptype, ppRspFile, ppRspContent, /*restat*/ "", /*generator*/ false); } if (needDyndep) { // Write the rule for ninja dyndep file generation. - std::vector<std::string> ddCmds; // Command line length is almost always limited -> use response file for // dyndep rules std::string ddRspFile = "$out.rsp"; std::string ddRspContent = "$in"; - std::string ddInput = "@" + ddRspFile; + std::string ddCmdLine; // Run CMake dependency scanner on the source file (using the preprocessed // source if that was performed). - std::string const cmake = this->GetLocalGenerator()->ConvertToOutputFormat( - cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); - ddCmds.push_back(cmake + - " -E cmake_ninja_dyndep" - " --tdi=" + - tdi + " --lang=" + lang + - " --dd=$out" - " " + - ddInput); - - std::string const ddCmdLine = - this->GetLocalGenerator()->BuildCommandLine(ddCmds); - - std::ostringstream ddComment; - ddComment << "Rule to generate ninja dyndep files for " << lang << "."; - std::ostringstream ddDesc; - ddDesc << "Generating " << lang << " dyndep file $out"; - this->GetGlobalGenerator()->AddRule( - this->LanguageDyndepRule(lang), ddCmdLine, ddDesc.str(), ddComment.str(), - /*depfile*/ "", - /*deps*/ "", ddRspFile, ddRspContent, - /*restat*/ "", - /*generator*/ false); + { + std::vector<std::string> ddCmds; + { + std::string ccmd = cmakeCmd; + ccmd += " -E cmake_ninja_dyndep --tdi="; + ccmd += tdi; + ccmd += " --lang="; + ccmd += lang; + ccmd += " --dd=$out "; + ccmd += "@"; + ccmd += ddRspFile; + ddCmds.emplace_back(std::move(ccmd)); + } + ddCmdLine = this->GetLocalGenerator()->BuildCommandLine(ddCmds); + } + std::string ddComment = "Rule to generate ninja dyndep files for "; + ddComment += lang; + ddComment += "."; + std::string ddDesc = "Generating "; + ddDesc += lang; + ddDesc += " dyndep file $out"; + this->GetGlobalGenerator()->AddRule(this->LanguageDyndepRule(lang), + ddCmdLine, ddDesc, ddComment, + /*depfile*/ "", + /*deps*/ "", ddRspFile, ddRspContent, + /*restat*/ "", + /*generator*/ false); } // If using a response file, move defines, includes, and flags into it. @@ -716,8 +731,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) const char* cppcheck = this->GeneratorTarget->GetProperty(cppcheck_prop); if ((iwyu && *iwyu) || (tidy && *tidy) || (cpplint && *cpplint) || (cppcheck && *cppcheck)) { - std::string run_iwyu = this->GetLocalGenerator()->ConvertToOutputFormat( - cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); + std::string run_iwyu = cmakeCmd; run_iwyu += " -E __run_co_compile"; if (!compilerLauncher.empty()) { // In __run_co_compile case the launcher command is supplied @@ -776,15 +790,17 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) this->GetLocalGenerator()->BuildCommandLine(compileCmds); // Write the rule for compiling file of the given language. - std::ostringstream comment; - comment << "Rule for compiling " << lang << " files."; - std::ostringstream description; - description << "Building " << lang << " object $out"; - this->GetGlobalGenerator()->AddRule( - this->LanguageCompilerRule(lang), cmdLine, description.str(), - comment.str(), depfile, deptype, rspfile, rspcontent, - /*restat*/ "", - /*generator*/ false); + std::string comment = "Rule for compiling "; + comment += lang; + comment += " files."; + std::string description = "Building "; + description += lang; + description += " object $out"; + this->GetGlobalGenerator()->AddRule(this->LanguageCompilerRule(lang), + cmdLine, description, comment, depfile, + deptype, rspfile, rspcontent, + /*restat*/ "", + /*generator*/ false); } void cmNinjaTargetGenerator::WriteObjectBuildStatements() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b133d14fb1c0183c647136188cf4fff0ed05c58e commit b133d14fb1c0183c647136188cf4fff0ed05c58e Author: Kyle Edwards <kyle.edwa...@kitware.com> AuthorDate: Fri Mar 15 11:01:59 2019 -0400 Commit: Kyle Edwards <kyle.edwa...@kitware.com> CommitDate: Mon May 13 10:45:36 2019 -0400 Refactor: Allow cmInstallGenerator::Compute() to return an error This is preparation for an upcoming merge request, which will add a new cmInstallGenerator that returns false if there are errors in the Compute() step. diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 8223dd1..b08dd1c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1372,7 +1372,9 @@ bool cmGlobalGenerator::Compute() for (cmLocalGenerator* localGen : this->LocalGenerators) { cmMakefile* mf = localGen->GetMakefile(); for (cmInstallGenerator* g : mf->GetInstallGenerators()) { - g->Compute(localGen); + if (!g->Compute(localGen)) { + return false; + } } } diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 62ce9f2..14288f6 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -43,9 +43,10 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator( cmInstallDirectoryGenerator::~cmInstallDirectoryGenerator() = default; -void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg) +bool cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg) { - LocalGenerator = lg; + this->LocalGenerator = lg; + return true; } void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index ac6e504..e30849f 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -29,7 +29,7 @@ public: bool optional = false); ~cmInstallDirectoryGenerator() override; - void Compute(cmLocalGenerator* lg) override; + bool Compute(cmLocalGenerator* lg) override; std::string GetDestination(std::string const& config) const; diff --git a/Source/cmInstallExportAndroidMKGenerator.cxx b/Source/cmInstallExportAndroidMKGenerator.cxx index 186b9df..7de3dd4 100644 --- a/Source/cmInstallExportAndroidMKGenerator.cxx +++ b/Source/cmInstallExportAndroidMKGenerator.cxx @@ -30,10 +30,11 @@ cmInstallExportAndroidMKGenerator::~cmInstallExportAndroidMKGenerator() { } -void cmInstallExportAndroidMKGenerator::Compute(cmLocalGenerator* lg) +bool cmInstallExportAndroidMKGenerator::Compute(cmLocalGenerator* lg) { this->LocalGenerator = lg; this->ExportSet->Compute(lg); + return true; } void cmInstallExportAndroidMKGenerator::GenerateScript(std::ostream& os) diff --git a/Source/cmInstallExportAndroidMKGenerator.h b/Source/cmInstallExportAndroidMKGenerator.h index 189084a..a92ff27 100644 --- a/Source/cmInstallExportAndroidMKGenerator.h +++ b/Source/cmInstallExportAndroidMKGenerator.h @@ -24,7 +24,7 @@ public: const char* name_space, bool exportOld); ~cmInstallExportAndroidMKGenerator(); - void Compute(cmLocalGenerator* lg); + bool Compute(cmLocalGenerator* lg) override; protected: virtual void GenerateScript(std::ostream& os); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 73a37cb..f5bedab 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -45,10 +45,11 @@ cmInstallExportGenerator::~cmInstallExportGenerator() delete this->EFGen; } -void cmInstallExportGenerator::Compute(cmLocalGenerator* lg) +bool cmInstallExportGenerator::Compute(cmLocalGenerator* lg) { this->LocalGenerator = lg; this->ExportSet->Compute(lg); + return true; } void cmInstallExportGenerator::ComputeTempDir() diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index d23cf06..c4d252c 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -34,7 +34,7 @@ public: cmExportSet* GetExportSet() { return this->ExportSet; } - void Compute(cmLocalGenerator* lg) override; + bool Compute(cmLocalGenerator* lg) override; cmLocalGenerator* GetLocalGenerator() const { return this->LocalGenerator; } diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 9eb8ad4..2ed9f73 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -42,9 +42,10 @@ cmInstallFilesGenerator::cmInstallFilesGenerator( cmInstallFilesGenerator::~cmInstallFilesGenerator() = default; -void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg) +bool cmInstallFilesGenerator::Compute(cmLocalGenerator* lg) { this->LocalGenerator = lg; + return true; } std::string cmInstallFilesGenerator::GetDestination( diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 0ef2a06..ac462d4 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -29,7 +29,7 @@ public: bool optional = false); ~cmInstallFilesGenerator() override; - void Compute(cmLocalGenerator* lg) override; + bool Compute(cmLocalGenerator* lg) override; std::string GetDestination(std::string const& config) const; diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index 9bd7ac3..dbe707d 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -60,7 +60,7 @@ public: /** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */ static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false); - virtual void Compute(cmLocalGenerator*) {} + virtual bool Compute(cmLocalGenerator*) { return true; } protected: void GenerateScript(std::ostream& os) override; diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index a513958..5832d27 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -29,7 +29,7 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script, cmInstallScriptGenerator::~cmInstallScriptGenerator() = default; -void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) +bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) { this->LocalGenerator = lg; @@ -49,6 +49,8 @@ void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) break; } } + + return true; } void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os, diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 05199d7..6af7371 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -23,7 +23,7 @@ public: const char* component, bool exclude_from_all); ~cmInstallScriptGenerator() override; - void Compute(cmLocalGenerator* lg) override; + bool Compute(cmLocalGenerator* lg) override; protected: void GenerateScriptActions(std::ostream& os, Indent indent) override; diff --git a/Source/cmInstallSubdirectoryGenerator.cxx b/Source/cmInstallSubdirectoryGenerator.cxx index ad7121f..1c0512c 100644 --- a/Source/cmInstallSubdirectoryGenerator.cxx +++ b/Source/cmInstallSubdirectoryGenerator.cxx @@ -41,9 +41,10 @@ void cmInstallSubdirectoryGenerator::CheckCMP0082( } } -void cmInstallSubdirectoryGenerator::Compute(cmLocalGenerator* lg) +bool cmInstallSubdirectoryGenerator::Compute(cmLocalGenerator* lg) { this->LocalGenerator = lg; + return true; } void cmInstallSubdirectoryGenerator::GenerateScript(std::ostream& os) diff --git a/Source/cmInstallSubdirectoryGenerator.h b/Source/cmInstallSubdirectoryGenerator.h index 35471dd..22759d9 100644 --- a/Source/cmInstallSubdirectoryGenerator.h +++ b/Source/cmInstallSubdirectoryGenerator.h @@ -28,7 +28,7 @@ public: void CheckCMP0082(bool& haveSubdirectoryInstall, bool& haveInstallAfterSubdirectory) override; - void Compute(cmLocalGenerator* lg) override; + bool Compute(cmLocalGenerator* lg) override; protected: void GenerateScript(std::ostream& os) override; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 4fefe23..7c5a55b 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -430,7 +430,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename( return fname; } -void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) +bool cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) { // Lookup this target in the current directory. this->Target = lg->FindLocalNonAliasGeneratorTarget(this->TargetName); @@ -439,6 +439,8 @@ void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) this->Target = lg->GetGlobalGenerator()->FindGeneratorTarget(this->TargetName); } + + return true; } void cmInstallTargetGenerator::AddTweak(std::ostream& os, Indent indent, diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 6df5b1a..ed3ab52 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -58,7 +58,7 @@ public: const std::string& config, NameType nameType = NameNormal); - void Compute(cmLocalGenerator* lg) override; + bool Compute(cmLocalGenerator* lg) override; cmGeneratorTarget* GetTarget() const { return this->Target; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cc04b1918301964ef7de0f44b77fdf1d82729ba commit 8cc04b1918301964ef7de0f44b77fdf1d82729ba Author: Kyle Edwards <kyle.edwa...@kitware.com> AuthorDate: Fri Mar 15 11:00:41 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon May 13 10:31:39 2019 -0400 cmake: Display error if generate step fails diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 121d12d..d19de21 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1733,6 +1733,11 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) return ret; } ret = this->Generate(); + if (ret) { + cmSystemTools::Message("CMake Generate step failed. " + "Build files cannot be regenerated correctly."); + return ret; + } std::string message = "Build files have been written to: "; message += this->GetHomeOutputDirectory(); this->UpdateProgress(message, -1); diff --git a/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake-stderr.txt b/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake-stderr.txt index ddb3cae..87ac88e 100644 --- a/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake-stderr.txt +++ b/Tests/RunCMake/CMP0069/CMP0069-NEW-cmake-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at CMP0069-NEW-cmake\.cmake:[0-9]+ \(add_executable\): CMake doesn't support IPO for current compiler Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler-stderr.txt b/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler-stderr.txt index 8decfab..cb9d19b 100644 --- a/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler-stderr.txt +++ b/Tests/RunCMake/CMP0069/CMP0069-NEW-compiler-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at CMP0069-NEW-compiler\.cmake:[0-9]+ \(add_executable\): Compiler doesn't support IPO Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/CMP0069/CMP0069-NEW-generator-stderr.txt b/Tests/RunCMake/CMP0069/CMP0069-NEW-generator-stderr.txt index 0e05ee7..1159ec0 100644 --- a/Tests/RunCMake/CMP0069/CMP0069-NEW-generator-stderr.txt +++ b/Tests/RunCMake/CMP0069/CMP0069-NEW-generator-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at CMP0069-NEW-generator\.cmake:[0-9]+ \(add_executable\): CMake doesn't support IPO for current generator Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt index 0e48ba4..86d3e04 100644 --- a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -50,4 +50,6 @@ CMake Error at BadAND.cmake:1 \(add_custom_target\): Parameters to \$<AND> must resolve to either '0' or '1'. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt index 964ea4d..42dd0ce 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -32,4 +32,6 @@ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): Expression syntax not recognized. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt index e5e628c..627327c 100644 --- a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt @@ -49,4 +49,6 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\): \$<NOT> parameter must resolve to exactly one '0' or '1' value. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt index eb26328..56e6af0 100644 --- a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -50,4 +50,6 @@ CMake Error at BadOR.cmake:1 \(add_custom_target\): Parameters to \$<OR> must resolve to either '0' or '1'. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt index dd0d931..2f04c78 100644 --- a/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadStrEqual-stderr.txt @@ -35,4 +35,6 @@ CMake Error at BadStrEqual.cmake:1 \(add_custom_target\): \$<STREQUAL> expression requires 2 comma separated parameters, but got 3 instead. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt index 969393a..98eed1f 100644 --- a/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadTargetName-stderr.txt @@ -5,4 +5,6 @@ CMake Error at BadTargetName.cmake:1 \(add_custom_target\): \$<TARGET_NAME> expression requires literal input. Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\)$ + CMakeLists.txt:3 \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt index 803058d..9afa461 100644 --- a/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt +++ b/Tests/RunCMake/MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt @@ -1,2 +1,4 @@ ^CMake Error in CMakeLists.txt: - MSVC_RUNTIME_LIBRARY value 'BogusValue' not known for this C compiler.$ + MSVC_RUNTIME_LIBRARY value 'BogusValue' not known for this C compiler. ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt index 40d650e..208f3c9 100644 --- a/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt +++ b/Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt @@ -2,4 +2,6 @@ The SOURCES of "A" use a generator expression that depends on the SOURCES themselves. Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt index fec12ae..6da79b7 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadInvalidName-stderr.txt @@ -47,4 +47,6 @@ \$<TARGET_PROPERTY:> \$<TARGET_PROPERTY:...> expression requires a non-empty property name. -*)+$ +*)+ ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt index 75865ad..d40b16b 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadNonTarget-stderr.txt @@ -5,4 +5,6 @@ CMake Error at BadNonTarget.cmake:7 \(include_directories\): Target "NonExistent" not found. Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ + CMakeLists\.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt index f0f71ec..fa26861 100644 --- a/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt +++ b/Tests/RunCMake/TargetPropertyGeneratorExpressions/BadSelfReference-stderr.txt @@ -34,4 +34,6 @@ \$<TARGET_PROPERTY:BadSelfReference6,COMPILE_DEFINITIONS> Self reference on target "BadSelfReference6". -*)+$ +*)+ ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-stderr.txt index 46a294d..69c61e6 100644 --- a/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-stderr.txt +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceDefinitions-stderr.txt @@ -5,4 +5,6 @@ specified for source: - .*/Tests/RunCMake/XcodeProject/main.c$ + .*/Tests/RunCMake/XcodeProject/main.c ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt index 6500649..c3e9e31 100644 --- a/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceFlags-stderr.txt @@ -5,4 +5,6 @@ specified for source: - .*/Tests/RunCMake/XcodeProject/main.c$ + .*/Tests/RunCMake/XcodeProject/main.c ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt index f9b8ee7..ff70b95 100644 --- a/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceIncludeDirs-stderr.txt @@ -5,4 +5,6 @@ specified for source: - .*/Tests/RunCMake/XcodeProject/main.c$ + .*/Tests/RunCMake/XcodeProject/main.c ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt index bfca020..100008a 100644 --- a/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt +++ b/Tests/RunCMake/XcodeProject/PerConfigPerSourceOptions-stderr.txt @@ -5,4 +5,6 @@ specified for source: - .*/Tests/RunCMake/XcodeProject/main.c$ + .*/Tests/RunCMake/XcodeProject/main.c ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_executable/NoSources-stderr.txt b/Tests/RunCMake/add_executable/NoSources-stderr.txt index 4fcfd49..abefc6d 100644 --- a/Tests/RunCMake/add_executable/NoSources-stderr.txt +++ b/Tests/RunCMake/add_executable/NoSources-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at NoSources.cmake:[0-9]+ \(add_executable\): No SOURCES given to target: TestExeWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt index 5561daa..80026bf 100644 --- a/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_executable/NoSourcesButLinkObjects-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at NoSourcesButLinkObjects.cmake:[0-9]+ \(add_executable\): No SOURCES given to target: TestExeWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt index 41da381..72b92ce 100644 --- a/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/MODULEwithNoSources-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at MODULEwithNoSources.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestModuleLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt index 67dd87c..1490524 100644 --- a/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/MODULEwithNoSourcesButLinkObjects-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at MODULEwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestModuleLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt index 20d3a8a..be7634c 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSources-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at OBJECTwithNoSources.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestObjectLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt index 1bcc114..3f85916 100644 --- a/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/OBJECTwithNoSourcesButLinkObjects-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at OBJECTwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestObjectLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt index 5cedd62..471eda1 100644 --- a/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/SHAREDwithNoSources-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at SHAREDwithNoSources.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestSharedLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt index d621e76..4bec7ae 100644 --- a/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/SHAREDwithNoSourcesButLinkObjects-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at SHAREDwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestSharedLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt index 10b2112..f655221 100644 --- a/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt +++ b/Tests/RunCMake/add_library/STATICwithNoSources-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at STATICwithNoSources.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestStaticLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt index 33c23b2..185aad8 100644 --- a/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt +++ b/Tests/RunCMake/add_library/STATICwithNoSourcesButLinkObjects-stderr.txt @@ -1,4 +1,6 @@ ^CMake Error at STATICwithNoSourcesButLinkObjects.cmake:[0-9]+ \(add_library\): No SOURCES given to target: TestStaticLibWithoutSources Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ + CMakeLists.txt:[0-9]+ \(include\) ++ +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cdff7f4e2a255e083e5a19ac541b4de2874785af commit cdff7f4e2a255e083e5a19ac541b4de2874785af Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Sun May 12 13:11:51 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Mon May 13 15:37:18 2019 +0200 cmSystemTools: Add ExpandedListArgument and ExpandedLists methods Changes ------- In `cmSystemTools` this - renames the method `ExpandList` to `ExpandLists` and makes it iterator based and adds the methods - `std::vector<std::string> ExpandedLists(InputIt first, InputIt last)` - `std::vector<std::string> ExpandedListArgument(const std::string& arg, bool emptyArgs)` Both return the `std::vector<std::string>` instead of taking a return vector reference like `cmSystemTools::ExpandLists` and `cmSystemTools::ExpandListArgument`. Motivation ---------- Since C++17 return value optimization is mandatory, so returning a `std:vector<std::string>` from a function should be (at least) as fast as passing a return vector reference to the function. The new methods can replace `cmSystemTools::ExpandLists` and `cmSystemTools::ExpandListArgument` in many cases, which leads to shorter and simpler syntax. E.g. the commonly used pattern ``` if (const char* value = X->GetProperty("A_KEY_STRING")) { std::vector<std::string> valuesList; cmSystemTools::ExpandListArgument(value, valuesList); for (std::string const& i : valuesList) { doSomething(i); } } ``` becomes ``` if (const char* value = X->GetProperty("A_KEY_STRING")) { for (std::string const& i : cmSystemTools::ExpandedListArgument(value)) { doSomething(i); } } ``` diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index db673bb..6cbdefa 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2485,12 +2485,10 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target, cmGeneratorTarget* gtgt) { - std::string configTypes = - this->CurrentMakefile->GetRequiredDefinition("CMAKE_CONFIGURATION_TYPES"); - std::vector<std::string> configVectorIn; - std::vector<std::string> configVector; - configVectorIn.push_back(configTypes); - cmSystemTools::ExpandList(configVectorIn, configVector); + std::vector<std::string> const configVector = + cmSystemTools::ExpandedListArgument( + this->CurrentMakefile->GetRequiredDefinition( + "CMAKE_CONFIGURATION_TYPES")); cmXCodeObject* configlist = this->CreateObject(cmXCodeObject::XCConfigurationList); cmXCodeObject* buildConfigurations = diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx index bb14e68..a64ad8c 100644 --- a/Source/cmRemoveCommand.cxx +++ b/Source/cmRemoveCommand.cxx @@ -25,15 +25,13 @@ bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args, } // expand the variable - std::vector<std::string> varArgsExpanded; - cmSystemTools::ExpandListArgument(cacheValue, varArgsExpanded); + std::vector<std::string> const varArgsExpanded = + cmSystemTools::ExpandedListArgument(cacheValue); // expand the args // check for REMOVE(VAR v1 v2 ... vn) - std::vector<std::string> argsExpanded; - std::vector<std::string> temp; - temp.insert(temp.end(), args.begin() + 1, args.end()); - cmSystemTools::ExpandList(temp, argsExpanded); + std::vector<std::string> const argsExpanded = + cmSystemTools::ExpandedLists(args.begin() + 1, args.end()); // now create the new value std::string value; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 17ed3f6..545e6c5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1208,16 +1208,8 @@ void cmSystemTools::GlobDirs(const std::string& path, } } -void cmSystemTools::ExpandList(std::vector<std::string> const& arguments, - std::vector<std::string>& newargs) -{ - for (std::string const& arg : arguments) { - cmSystemTools::ExpandListArgument(arg, newargs); - } -} - void cmSystemTools::ExpandListArgument(const std::string& arg, - std::vector<std::string>& newargs, + std::vector<std::string>& argsOut, bool emptyArgs) { // If argument is empty, it is an empty list. @@ -1226,7 +1218,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, } // if there are no ; in the name then just copy the current string if (arg.find(';') == std::string::npos) { - newargs.push_back(arg); + argsOut.push_back(arg); return; } std::string newArg; @@ -1260,7 +1252,7 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, last = c + 1; if (!newArg.empty() || emptyArgs) { // Add the last argument if the string is not empty. - newargs.push_back(newArg); + argsOut.push_back(newArg); newArg.clear(); } } @@ -1273,10 +1265,18 @@ void cmSystemTools::ExpandListArgument(const std::string& arg, newArg.append(last); if (!newArg.empty() || emptyArgs) { // Add the last argument if the string is not empty. - newargs.push_back(newArg); + argsOut.push_back(newArg); } } +std::vector<std::string> cmSystemTools::ExpandedListArgument( + const std::string& arg, bool emptyArgs) +{ + std::vector<std::string> argsOut; + ExpandListArgument(arg, argsOut, emptyArgs); + return argsOut; +} + bool cmSystemTools::SimpleGlob(const std::string& glob, std::vector<std::string>& files, int type /* = 0 */) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 8a87a37..d145d47 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -29,17 +29,50 @@ public: typedef cmsys::SystemTools Superclass; typedef cmProcessOutput::Encoding Encoding; - /** Expand out any arguments in the vector that have ; separated - * strings into multiple arguments. A new vector is created - * containing the expanded versions of all arguments in argsIn. + /** + * Expand the ; separated string @a arg into multiple arguments. + * All found arguments are appended to @a argsOut. */ - static void ExpandList(std::vector<std::string> const& argsIn, - std::vector<std::string>& argsOut); static void ExpandListArgument(const std::string& arg, std::vector<std::string>& argsOut, bool emptyArgs = false); /** + * Expand out any arguments in the string range [@a first, @a last) that have + * ; separated strings into multiple arguments. All found arguments are + * appended to @a argsOut. + */ + template <class InputIt> + static void ExpandLists(InputIt first, InputIt last, + std::vector<std::string>& argsOut) + { + for (; first != last; ++first) { + cmSystemTools::ExpandListArgument(*first, argsOut); + } + } + + /** + * Same as ExpandListArgument but a new vector is created containing + * the expanded arguments from the string @a arg. + */ + static std::vector<std::string> ExpandedListArgument(const std::string& arg, + bool emptyArgs = false); + + /** + * Same as ExpandList but a new vector is created containing the expanded + * versions of all arguments in the string range [@a first, @a last). + */ + template <class InputIt> + static std::vector<std::string> ExpandedLists(InputIt first, InputIt last) + { + std::vector<std::string> argsOut; + for (; first != last; ++first) { + cmSystemTools::ExpandListArgument(*first, argsOut); + } + return argsOut; + } + + /** * Look for and replace registry values in a string */ static void ExpandRegistryValues(std::string& source, https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8691b3cf914c97ed9e3612009707bc5a791ef4f0 commit 8691b3cf914c97ed9e3612009707bc5a791ef4f0 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Thu May 9 21:25:54 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Sun May 12 18:56:53 2019 +0200 Ninja: Inline range loop range arguments diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 71516a2..760a5ab 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -995,8 +995,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( { if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { // These depend only on other CMake-provided targets, e.g. "all". - std::set<BT<std::string>> const& utils = target->GetUtilities(); - for (BT<std::string> const& util : utils) { + for (BT<std::string> const& util : target->GetUtilities()) { std::string d = target->GetLocalGenerator()->GetCurrentBinaryDirectory() + "/" + util.Value; @@ -1004,8 +1003,8 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( } } else { cmNinjaDeps outs; - cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); - for (cmTargetDepend const& targetDep : targetDeps) { + for (cmTargetDepend const& targetDep : + this->GetTargetDirectDepends(target)) { if (targetDep->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -1039,10 +1038,9 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure( // relevant for filling the cache entries properly isolated and a global // result set that is relevant for the result of the top level call to // AppendTargetDependsClosure. - auto const& targetDeps = this->GetTargetDirectDepends(target); cmNinjaOuts this_outs; // this will be the new cache entry - for (auto const& dep_target : targetDeps) { + for (auto const& dep_target : this->GetTargetDirectDepends(target)) { if (dep_target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -1138,9 +1136,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) // The directory-level rule should depend on the directory-level // rules of the subdirectories. - std::vector<cmStateSnapshot> const& children = - lg->GetStateSnapshot().GetChildren(); - for (cmStateSnapshot const& state : children) { + for (cmStateSnapshot const& state : lg->GetStateSnapshot().GetChildren()) { std::string const currentBinaryDir = state.GetDirectory().GetCurrentBinary(); @@ -1201,26 +1197,21 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os) for (cmLocalGenerator* lg : this->LocalGenerators) { // get the vector of files created by this makefile and convert them // to ninja paths, which are all relative in respect to the build directory - const std::vector<std::string>& files = - lg->GetMakefile()->GetOutputFiles(); - for (std::string const& file : files) { + for (std::string const& file : lg->GetMakefile()->GetOutputFiles()) { knownDependencies.insert(this->ConvertToNinjaPath(file)); } if (!this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION")) { // get list files which are implicit dependencies as well and will be // phony for rebuild manifest - std::vector<std::string> const& lf = lg->GetMakefile()->GetListFiles(); - for (std::string const& j : lf) { + for (std::string const& j : lg->GetMakefile()->GetListFiles()) { knownDependencies.insert(this->ConvertToNinjaPath(j)); } } - std::vector<cmGeneratorExpressionEvaluationFile*> const& ef = - lg->GetMakefile()->GetEvaluationFiles(); - for (cmGeneratorExpressionEvaluationFile* li : ef) { + for (cmGeneratorExpressionEvaluationFile* li : + lg->GetMakefile()->GetEvaluationFiles()) { // get all the files created by generator expressions and convert them // to ninja paths - std::vector<std::string> evaluationFiles = li->GetFiles(); - for (std::string const& evaluationFile : evaluationFiles) { + for (std::string const& evaluationFile : li->GetFiles()) { knownDependencies.insert(this->ConvertToNinjaPath(evaluationFile)); } } @@ -1347,9 +1338,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) cmNinjaDeps implicitDeps; cmNinjaDeps explicitDeps; for (cmLocalGenerator* localGen : this->LocalGenerators) { - std::vector<std::string> const& lf = - localGen->GetMakefile()->GetListFiles(); - for (std::string const& fi : lf) { + for (std::string const& fi : localGen->GetMakefile()->GetListFiles()) { implicitDeps.push_back(this->ConvertToNinjaPath(fi)); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index f4e3ed8..515651a 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -79,8 +79,7 @@ void cmLocalNinjaGenerator::Generate() } } - const std::vector<cmGeneratorTarget*>& targets = this->GetGeneratorTargets(); - for (cmGeneratorTarget* target : targets) { + for (cmGeneratorTarget* target : this->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -283,8 +282,7 @@ void cmLocalNinjaGenerator::AppendTargetDepends(cmGeneratorTarget* target, void cmLocalNinjaGenerator::AppendCustomCommandDeps( cmCustomCommandGenerator const& ccg, cmNinjaDeps& ninjaDeps) { - const std::vector<std::string>& deps = ccg.GetDepends(); - for (std::string const& i : deps) { + for (std::string const& i : ccg.GetDepends()) { std::string dep; if (this->GetRealDependency(i, this->GetConfigName(), dep)) { ninjaDeps.push_back( diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 2324839..ee10891 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1212,8 +1212,7 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang) Json::Value& tdi_linked_target_dirs = tdi["linked-target-dirs"] = Json::arrayValue; - std::vector<std::string> linked = this->GetLinkedTargetDirectories(); - for (std::string const& l : linked) { + for (std::string const& l : this->GetLinkedTargetDirectories()) { tdi_linked_target_dirs.append(l); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=47da9859e8b5e938fa40b69d117aecef82e090a9 commit 47da9859e8b5e938fa40b69d117aecef82e090a9 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 10 11:54:58 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Sat May 11 15:51:30 2019 +0200 Ninja: In cmGlobalNinjaGenerator use std::unique_ptr to manage output streams diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 90d0f61..71516a2 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -424,9 +424,6 @@ void cmGlobalNinjaGenerator::WriteDefault(std::ostream& os, cmGlobalNinjaGenerator::cmGlobalNinjaGenerator(cmake* cm) : cmGlobalCommonGenerator(cm) - , BuildFileStream(nullptr) - , RulesFileStream(nullptr) - , CompileCommandsStream(nullptr) , UsingGCCOnWindows(false) , ComputingUnknownDependencies(false) , PolicyCMP0058(cmPolicies::WARN) @@ -487,8 +484,12 @@ void cmGlobalNinjaGenerator::Generate() msg.str()); return; } - this->OpenBuildFileStream(); - this->OpenRulesFileStream(); + if (!this->OpenBuildFileStream()) { + return; + } + if (!this->OpenRulesFileStream()) { + return; + } this->TargetDependsClosures.clear(); @@ -737,7 +738,7 @@ void cmGlobalNinjaGenerator::ComputeTargetObjectDirectory( // Private methods -void cmGlobalNinjaGenerator::OpenBuildFileStream() +bool cmGlobalNinjaGenerator::OpenBuildFileStream() { // Compute Ninja's build file path. std::string buildFilePath = @@ -747,12 +748,12 @@ void cmGlobalNinjaGenerator::OpenBuildFileStream() // Get a stream where to generate things. if (!this->BuildFileStream) { - this->BuildFileStream = new cmGeneratedFileStream( + this->BuildFileStream = cm::make_unique<cmGeneratedFileStream>( buildFilePath, false, this->GetMakefileEncoding()); - if (!this->BuildFileStream) { + if (!(*this->BuildFileStream)) { // An error message is generated by the constructor if it cannot // open the file. - return; + return false; } } @@ -763,19 +764,20 @@ void cmGlobalNinjaGenerator::OpenBuildFileStream() *this->BuildFileStream << "# This file contains all the build statements describing the\n" << "# compilation DAG.\n\n"; + + return true; } void cmGlobalNinjaGenerator::CloseBuildFileStream() { if (this->BuildFileStream) { - delete this->BuildFileStream; - this->BuildFileStream = nullptr; + this->BuildFileStream.reset(); } else { cmSystemTools::Error("Build file stream was not open."); } } -void cmGlobalNinjaGenerator::OpenRulesFileStream() +bool cmGlobalNinjaGenerator::OpenRulesFileStream() { // Compute Ninja's build file path. std::string rulesFilePath = @@ -785,12 +787,12 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream() // Get a stream where to generate things. if (!this->RulesFileStream) { - this->RulesFileStream = new cmGeneratedFileStream( + this->RulesFileStream = cm::make_unique<cmGeneratedFileStream>( rulesFilePath, false, this->GetMakefileEncoding()); - if (!this->RulesFileStream) { + if (!(*this->RulesFileStream)) { // An error message is generated by the constructor if it cannot // open the file. - return; + return false; } } @@ -805,13 +807,13 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream() << "# It is included in the main '" << NINJA_BUILD_FILE << "'.\n\n" ; /* clang-format on */ + return true; } void cmGlobalNinjaGenerator::CloseRulesFileStream() { if (this->RulesFileStream) { - delete this->RulesFileStream; - this->RulesFileStream = nullptr; + this->RulesFileStream.reset(); } else { cmSystemTools::Error("Rules file stream was not open."); } @@ -868,7 +870,8 @@ void cmGlobalNinjaGenerator::AddCXXCompileCommand( } // Get a stream where to generate things. - this->CompileCommandsStream = new cmGeneratedFileStream(buildFilePath); + this->CompileCommandsStream = + cm::make_unique<cmGeneratedFileStream>(buildFilePath); *this->CompileCommandsStream << "["; } else { *this->CompileCommandsStream << "," << std::endl; @@ -896,8 +899,7 @@ void cmGlobalNinjaGenerator::CloseCompileCommandsStream() { if (this->CompileCommandsStream) { *this->CompileCommandsStream << "\n]"; - delete this->CompileCommandsStream; - this->CompileCommandsStream = nullptr; + this->CompileCommandsStream.reset(); } } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 9c9cc1d..ce9d124 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -7,6 +7,7 @@ #include <iosfwd> #include <map> +#include <memory> // IWYU pragma: keep #include <set> #include <string> #include <unordered_map> @@ -14,6 +15,7 @@ #include <utility> #include <vector> +#include "cmGeneratedFileStream.h" #include "cmGlobalCommonGenerator.h" #include "cmGlobalGenerator.h" #include "cmGlobalGeneratorFactory.h" @@ -22,7 +24,6 @@ #include "cm_codecvt.hxx" class cmCustomCommand; -class cmGeneratedFileStream; class cmGeneratorTarget; class cmLinkLineComputer; class cmLocalGenerator; @@ -234,12 +235,12 @@ public: cmGeneratedFileStream* GetBuildFileStream() const { - return this->BuildFileStream; + return this->BuildFileStream.get(); } cmGeneratedFileStream* GetRulesFileStream() const { - return this->RulesFileStream; + return this->RulesFileStream.get(); } std::string const& ConvertToNinjaPath(const std::string& path) const; @@ -379,12 +380,12 @@ private: cmMakefile* mf) const override; bool CheckFortran(cmMakefile* mf) const; - void OpenBuildFileStream(); + bool OpenBuildFileStream(); void CloseBuildFileStream(); void CloseCompileCommandsStream(); - void OpenRulesFileStream(); + bool OpenRulesFileStream(); void CloseRulesFileStream(); /// Write the common disclaimer text at the top of each build file. @@ -411,11 +412,11 @@ private: /// The file containing the build statement. (the relationship of the /// compilation DAG). - cmGeneratedFileStream* BuildFileStream; + std::unique_ptr<cmGeneratedFileStream> BuildFileStream; /// The file containing the rule statements. (The action attached to each /// edge of the compilation DAG). - cmGeneratedFileStream* RulesFileStream; - cmGeneratedFileStream* CompileCommandsStream; + std::unique_ptr<cmGeneratedFileStream> RulesFileStream; + std::unique_ptr<cmGeneratedFileStream> CompileCommandsStream; /// The set of rules added to the generated build system. std::unordered_set<std::string> Rules; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=990270213408bb4d11fa620ba9c96b25da313945 commit 990270213408bb4d11fa620ba9c96b25da313945 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 10 12:07:03 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Fri May 10 20:22:26 2019 +0200 Ninja: Add and use cmGlobalNinjaGenerator::CMakeCmd method diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 5b5c812..90d0f61 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -290,14 +290,8 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild( void cmGlobalNinjaGenerator::AddMacOSXContentRule() { - cmLocalGenerator* lg = this->LocalGenerators[0]; - - std::ostringstream cmd; - cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(), - cmOutputConverter::SHELL) - << " -E copy $in $out"; - - this->AddRule("COPY_OSX_CONTENT", cmd.str(), "Copying OS X Content $out", + this->AddRule("COPY_OSX_CONTENT", CMakeCmd() + " -E copy $in $out", + "Copying OS X Content $out", "Rule for copying OS X bundle content file.", /*depfile*/ "", /*deptype*/ "", @@ -1330,23 +1324,23 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) } cmLocalGenerator* lg = this->LocalGenerators[0]; - std::ostringstream cmd; - cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(), - cmOutputConverter::SHELL) - << " -S" - << lg->ConvertToOutputFormat(lg->GetSourceDirectory(), - cmOutputConverter::SHELL) - << " -B" - << lg->ConvertToOutputFormat(lg->GetBinaryDirectory(), - cmOutputConverter::SHELL); - WriteRule(*this->RulesFileStream, "RERUN_CMAKE", cmd.str(), - "Re-running CMake...", "Rule for re-running cmake.", - /*depfile=*/"", - /*deptype=*/"", - /*rspfile=*/"", - /*rspcontent*/ "", - /*restat=*/"", - /*generator=*/true); + { + std::string cmd = CMakeCmd(); + cmd += " -S"; + cmd += lg->ConvertToOutputFormat(lg->GetSourceDirectory(), + cmOutputConverter::SHELL); + cmd += " -B"; + cmd += lg->ConvertToOutputFormat(lg->GetBinaryDirectory(), + cmOutputConverter::SHELL); + WriteRule(*this->RulesFileStream, "RERUN_CMAKE", cmd, + "Re-running CMake...", "Rule for re-running cmake.", + /*depfile=*/"", + /*deptype=*/"", + /*rspfile=*/"", + /*rspcontent*/ "", + /*restat=*/"", + /*generator=*/true); + } cmNinjaDeps implicitDeps; cmNinjaDeps explicitDeps; @@ -1368,22 +1362,22 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) cmake* cm = this->GetCMakeInstance(); if (this->SupportsManifestRestat() && cm->DoWriteGlobVerifyTarget()) { - std::ostringstream verify_cmd; - verify_cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(), - cmOutputConverter::SHELL) - << " -P " - << lg->ConvertToOutputFormat(cm->GetGlobVerifyScript(), - cmOutputConverter::SHELL); - - WriteRule(*this->RulesFileStream, "VERIFY_GLOBS", verify_cmd.str(), - "Re-checking globbed directories...", - "Rule for re-checking globbed directories.", - /*depfile=*/"", - /*deptype=*/"", - /*rspfile=*/"", - /*rspcontent*/ "", - /*restat=*/"", - /*generator=*/true); + { + std::string cmd = CMakeCmd(); + cmd += " -P "; + cmd += lg->ConvertToOutputFormat(cm->GetGlobVerifyScript(), + cmOutputConverter::SHELL); + + WriteRule(*this->RulesFileStream, "VERIFY_GLOBS", cmd, + "Re-checking globbed directories...", + "Rule for re-checking globbed directories.", + /*depfile=*/"", + /*deptype=*/"", + /*rspfile=*/"", + /*rspcontent*/ "", + /*restat=*/"", + /*generator=*/true); + } std::string verifyForce = cm->GetGlobVerifyScript() + "_force"; cmNinjaDeps verifyForceDeps(1, this->NinjaOutputPath(verifyForce)); @@ -1446,10 +1440,17 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) missingInputs, cmNinjaDeps()); } -std::string cmGlobalNinjaGenerator::ninjaCmd() const +std::string cmGlobalNinjaGenerator::CMakeCmd() const +{ + cmLocalGenerator* lgen = this->LocalGenerators.at(0); + return lgen->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(), + cmOutputConverter::SHELL); +} + +std::string cmGlobalNinjaGenerator::NinjaCmd() const { cmLocalGenerator* lgen = this->LocalGenerators[0]; - if (lgen) { + if (lgen != nullptr) { return lgen->ConvertToOutputFormat(this->NinjaCommand, cmOutputConverter::SHELL); } @@ -1478,7 +1479,7 @@ bool cmGlobalNinjaGenerator::SupportsMultilineDepfile() const void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) { - WriteRule(*this->RulesFileStream, "CLEAN", ninjaCmd() + " -t clean", + WriteRule(*this->RulesFileStream, "CLEAN", NinjaCmd() + " -t clean", "Cleaning all built files...", "Rule for cleaning all built files.", /*depfile=*/"", @@ -1498,7 +1499,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) { - WriteRule(*this->RulesFileStream, "HELP", ninjaCmd() + " -t targets", + WriteRule(*this->RulesFileStream, "HELP", NinjaCmd() + " -t targets", "All primary targets available:", "Rule for printing all primary targets available.", /*depfile=*/"", diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 4cd1a98..9c9cc1d 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -406,7 +406,8 @@ private: cmGeneratorTarget const* target, std::set<cmGeneratorTarget const*>& depends); - std::string ninjaCmd() const; + std::string CMakeCmd() const; + std::string NinjaCmd() const; /// The file containing the build statement. (the relationship of the /// compilation DAG). https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12aa6fe07bc2f3903386fb1f57ace6601ec91100 commit 12aa6fe07bc2f3903386fb1f57ace6601ec91100 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Thu May 9 21:18:59 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Fri May 10 20:22:26 2019 +0200 Ninja: Fix message in cmGlobalNinjaGenerator::WriteBuild method diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 684a679..5b5c812 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -136,17 +136,15 @@ void cmGlobalNinjaGenerator::WriteBuild( { // Make sure there is a rule. if (rule.empty()) { - cmSystemTools::Error("No rule for WriteBuildStatement! called " - "with comment: " + + cmSystemTools::Error("No rule for WriteBuild! called with comment: " + comment); return; } // Make sure there is at least one output file. if (outputs.empty()) { - cmSystemTools::Error("No output files for WriteBuildStatement! called " - "with comment: " + - comment); + cmSystemTools::Error( + "No output files for WriteBuild! called with comment: " + comment); return; } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02293841e742c14a18155bc0e10c39462c97dcbf commit 02293841e742c14a18155bc0e10c39462c97dcbf Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Fri May 10 11:22:38 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Fri May 10 20:22:26 2019 +0200 Ninja: Simplify cmGlobalNinjaGenerator::AddRule and HasRule methods - Use `std::unordered_set` for the emitted rule register - Use `std::unordered_map` for command length register diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 06234aa..684a679 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -706,22 +706,20 @@ void cmGlobalNinjaGenerator::AddRule( const std::string& restat, bool generator) { // Do not add the same rule twice. - if (this->HasRule(name)) { + if (!this->Rules.insert(name).second) { return; } - - this->Rules.insert(name); + // Store command length + this->RuleCmdLength[name] = static_cast<int>(command.size()); + // Write rule cmGlobalNinjaGenerator::WriteRule(*this->RulesFileStream, name, command, description, comment, depfile, deptype, rspfile, rspcontent, restat, generator); - - this->RuleCmdLength[name] = static_cast<int>(command.size()); } bool cmGlobalNinjaGenerator::HasRule(const std::string& name) { - RulesSetType::const_iterator rule = this->Rules.find(name); - return (rule != this->Rules.end()); + return (this->Rules.find(name) != this->Rules.end()); } // Private virtual overrides diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index efd1d8f..4cd1a98 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -10,6 +10,7 @@ #include <set> #include <string> #include <unordered_map> +#include <unordered_set> #include <utility> #include <vector> @@ -415,15 +416,11 @@ private: cmGeneratedFileStream* RulesFileStream; cmGeneratedFileStream* CompileCommandsStream; - /// The type used to store the set of rules added to the generated build - /// system. - typedef std::set<std::string> RulesSetType; - /// The set of rules added to the generated build system. - RulesSetType Rules; + std::unordered_set<std::string> Rules; /// Length of rule command, used by rsp file evaluation - std::map<std::string, int> RuleCmdLength; + std::unordered_map<std::string, int> RuleCmdLength; /// The set of dependencies to add to the "all" target. cmNinjaDeps AllDependencies; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a173a1173e06dad812afe17c9751cb7c2f94eda4 commit a173a1173e06dad812afe17c9751cb7c2f94eda4 Author: Sebastian Holtermann <sebh...@xwmw.org> AuthorDate: Thu May 9 21:15:56 2019 +0200 Commit: Sebastian Holtermann <sebh...@xwmw.org> CommitDate: Fri May 10 20:22:26 2019 +0200 Ninja: Simplify cmGlobalNinjaGenerator::WriteRule method diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 4fa6ee6..06234aa 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -332,71 +332,57 @@ void cmGlobalNinjaGenerator::WriteRule( const std::string& rspfile, const std::string& rspcontent, const std::string& restat, bool generator) { + // -- Parameter checks // Make sure the rule has a name. if (name.empty()) { - cmSystemTools::Error("No name given for WriteRuleStatement! called " - "with comment: " + + cmSystemTools::Error("No name given for WriteRule! called with comment: " + comment); return; } // Make sure a command is given. if (command.empty()) { - cmSystemTools::Error("No command given for WriteRuleStatement! called " - "with comment: " + - comment); + cmSystemTools::Error( + "No command given for WriteRule! called with comment: " + comment); return; } - cmGlobalNinjaGenerator::WriteComment(os, comment); - - // Write the rule. - os << "rule " << name << "\n"; - - // Write the depfile if any. - if (!depfile.empty()) { - cmGlobalNinjaGenerator::Indent(os, 1); - os << "depfile = " << depfile << "\n"; - } - - // Write the deptype if any. - if (!deptype.empty()) { - cmGlobalNinjaGenerator::Indent(os, 1); - os << "deps = " << deptype << "\n"; + // Make sure response file content is given + if (!rspfile.empty() && rspcontent.empty()) { + cmSystemTools::Error("rspfile but no rspfile_content given for WriteRule! " + "called with comment: " + + comment); + return; } - // Write the command. - cmGlobalNinjaGenerator::Indent(os, 1); - os << "command = " << command << "\n"; - - // Write the description if any. - if (!description.empty()) { - cmGlobalNinjaGenerator::Indent(os, 1); - os << "description = " << description << "\n"; - } + // -- Write rule + // Write rule intro + cmGlobalNinjaGenerator::WriteComment(os, comment); + os << "rule " << name << '\n'; - if (!rspfile.empty()) { - if (rspcontent.empty()) { - cmSystemTools::Error("No rspfile_content given!" + comment); - return; + // Write rule key/value pairs + auto writeKV = [&os](const char* key, std::string const& value) { + if (!value.empty()) { + cmGlobalNinjaGenerator::Indent(os, 1); + os << key << " = " << value << '\n'; } - cmGlobalNinjaGenerator::Indent(os, 1); - os << "rspfile = " << rspfile << "\n"; - cmGlobalNinjaGenerator::Indent(os, 1); - os << "rspfile_content = " << rspcontent << "\n"; - } + }; - if (!restat.empty()) { - cmGlobalNinjaGenerator::Indent(os, 1); - os << "restat = " << restat << "\n"; + writeKV("depfile", depfile); + writeKV("deps", deptype); + writeKV("command", command); + writeKV("description", description); + if (!rspfile.empty()) { + writeKV("rspfile", rspfile); + writeKV("rspfile_content", rspcontent); } - + writeKV("restat", restat); if (generator) { - cmGlobalNinjaGenerator::Indent(os, 1); - os << "generator = 1\n"; + writeKV("generator", "1"); } - os << "\n"; + // Finish rule + os << '\n'; } void cmGlobalNinjaGenerator::WriteVariable(std::ostream& os, ----------------------------------------------------------------------- Summary of changes: Modules/Compiler/Intel-CXX-FeatureTests.cmake | 2 +- Modules/Compiler/Intel-CXX.cmake | 8 +- Modules/Compiler/MSVC-CXX-FeatureTests.cmake | 6 +- Modules/Compiler/MSVC-CXX.cmake | 1 + Source/cmGlobalGenerator.cxx | 4 +- Source/cmGlobalNinjaGenerator.cxx | 268 +++++++++------------ Source/cmGlobalNinjaGenerator.h | 31 ++- Source/cmGlobalXCodeGenerator.cxx | 10 +- Source/cmInstallDirectoryGenerator.cxx | 5 +- Source/cmInstallDirectoryGenerator.h | 2 +- Source/cmInstallExportAndroidMKGenerator.cxx | 3 +- Source/cmInstallExportAndroidMKGenerator.h | 2 +- Source/cmInstallExportGenerator.cxx | 3 +- Source/cmInstallExportGenerator.h | 2 +- Source/cmInstallFilesGenerator.cxx | 3 +- Source/cmInstallFilesGenerator.h | 2 +- Source/cmInstallGenerator.h | 2 +- Source/cmInstallScriptGenerator.cxx | 4 +- Source/cmInstallScriptGenerator.h | 2 +- Source/cmInstallSubdirectoryGenerator.cxx | 3 +- Source/cmInstallSubdirectoryGenerator.h | 2 +- Source/cmInstallTargetGenerator.cxx | 4 +- Source/cmInstallTargetGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 9 +- Source/cmNinjaTargetGenerator.cxx | 152 ++++++------ Source/cmNinjaTargetGenerator.h | 4 +- Source/cmRemoveCommand.cxx | 10 +- Source/cmSystemTools.cxx | 24 +- Source/cmSystemTools.h | 43 +++- Source/cmake.cxx | 5 + Tests/CompileFeatures/cxx_relaxed_constexpr.cpp | 3 +- .../RunCMake/CMP0069/CMP0069-NEW-cmake-stderr.txt | 4 +- .../CMP0069/CMP0069-NEW-compiler-stderr.txt | 4 +- .../CMP0069/CMP0069-NEW-generator-stderr.txt | 4 +- .../RunCMake/GeneratorExpression/BadAND-stderr.txt | 4 +- .../GeneratorExpression/BadCONFIG-stderr.txt | 4 +- .../RunCMake/GeneratorExpression/BadNOT-stderr.txt | 4 +- .../RunCMake/GeneratorExpression/BadOR-stderr.txt | 4 +- .../GeneratorExpression/BadStrEqual-stderr.txt | 4 +- .../GeneratorExpression/BadTargetName-stderr.txt | 4 +- .../MSVCRuntimeLibrary/CMP0091-NEW-stderr.txt | 4 +- Tests/RunCMake/ObjectLibrary/OwnSources-stderr.txt | 4 +- .../BadInvalidName-stderr.txt | 4 +- .../BadNonTarget-stderr.txt | 4 +- .../BadSelfReference-stderr.txt | 4 +- .../PerConfigPerSourceDefinitions-stderr.txt | 4 +- .../PerConfigPerSourceFlags-stderr.txt | 4 +- .../PerConfigPerSourceIncludeDirs-stderr.txt | 4 +- .../PerConfigPerSourceOptions-stderr.txt | 4 +- Tests/RunCMake/add_executable/NoSources-stderr.txt | 4 +- .../NoSourcesButLinkObjects-stderr.txt | 4 +- .../add_library/MODULEwithNoSources-stderr.txt | 4 +- .../MODULEwithNoSourcesButLinkObjects-stderr.txt | 4 +- .../add_library/OBJECTwithNoSources-stderr.txt | 4 +- .../OBJECTwithNoSourcesButLinkObjects-stderr.txt | 4 +- .../add_library/SHAREDwithNoSources-stderr.txt | 4 +- .../SHAREDwithNoSourcesButLinkObjects-stderr.txt | 4 +- .../add_library/STATICwithNoSources-stderr.txt | 4 +- .../STATICwithNoSourcesButLinkObjects-stderr.txt | 4 +- 59 files changed, 405 insertions(+), 328 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits