Implemented in all cmGlobaleGenerator sub-classes. Used in: Source/cmLocalGenerator.cxx Source/cmake.cxx
| 606 | // Source/cmLocalGenerator.cxx |
| 607 | // Source/cmake.cxx |
| 608 | void cmGlobalNinjaGenerator::Generate() |
| 609 | { |
| 610 | // Check minimum Ninja version. |
| 611 | if (cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, this->NinjaVersion, |
| 612 | RequiredNinjaVersion())) { |
| 613 | std::ostringstream msg; |
| 614 | msg << "The detected version of Ninja (" << this->NinjaVersion; |
| 615 | msg << ") is less than the version of Ninja required by CMake ("; |
| 616 | msg << cmGlobalNinjaGenerator::RequiredNinjaVersion() << ")."; |
| 617 | this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, |
| 618 | msg.str()); |
| 619 | return; |
| 620 | } |
| 621 | this->InitOutputPathPrefix(); |
| 622 | if (!this->OpenBuildFileStreams()) { |
| 623 | return; |
| 624 | } |
| 625 | if (!this->OpenRulesFileStream()) { |
| 626 | return; |
| 627 | } |
| 628 | |
| 629 | for (auto& it : this->Configs) { |
| 630 | it.second.TargetDependsClosures.clear(); |
| 631 | } |
| 632 | |
| 633 | this->TargetAll = this->NinjaOutputPath("all"); |
| 634 | this->CMakeCacheFile = this->NinjaOutputPath("CMakeCache.txt"); |
| 635 | this->DiagnosedCxxModuleNinjaSupport = false; |
| 636 | this->ClangTidyExportFixesDirs.clear(); |
| 637 | this->ClangTidyExportFixesFiles.clear(); |
| 638 | |
| 639 | this->cmGlobalGenerator::Generate(); |
| 640 | |
| 641 | this->WriteAssumedSourceDependencies(); |
| 642 | this->WriteTargetAliases(*this->GetCommonFileStream()); |
| 643 | this->WriteFolderTargets(*this->GetCommonFileStream()); |
| 644 | this->WriteBuiltinTargets(*this->GetCommonFileStream()); |
| 645 | |
| 646 | if (cmSystemTools::GetErrorOccurredFlag()) { |
| 647 | this->RulesFileStream->setstate(std::ios::failbit); |
| 648 | for (std::string const& config : this->GetConfigNames()) { |
| 649 | this->GetImplFileStream(config)->setstate(std::ios::failbit); |
| 650 | this->GetConfigFileStream(config)->setstate(std::ios::failbit); |
| 651 | } |
| 652 | this->GetCommonFileStream()->setstate(std::ios::failbit); |
| 653 | } |
| 654 | |
| 655 | this->CloseCompileCommandsStream(); |
| 656 | this->CloseRulesFileStream(); |
| 657 | this->CloseBuildFileStreams(); |
| 658 | |
| 659 | #ifdef _WIN32 |
| 660 | // Older ninja tools will not be able to update metadata on Windows |
| 661 | // when we are re-generating inside an existing 'ninja' invocation |
| 662 | // because the outer tool has the files open for write. |
| 663 | if (this->NinjaSupportsMetadataOnRegeneration || |
| 664 | !this->GetCMakeInstance()->GetRegenerateDuringBuild()) |
| 665 | #endif |
nothing calls this directly
no test coverage detected