MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteCxxModuleBmiBuildStatement

Method WriteCxxModuleBmiBuildStatement

Source/cmNinjaTargetGenerator.cxx:1766–1908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1764}
1765
1766void cmNinjaTargetGenerator::WriteCxxModuleBmiBuildStatement(
1767 cmSourceFile const* source, std::string const& config,
1768 std::string const& fileConfig, bool firstForConfig)
1769{
1770 std::string const language = source->GetLanguage();
1771 if (language != "CXX"_s) {
1772 this->GetMakefile()->IssueMessage(
1773 MessageType::FATAL_ERROR,
1774 cmStrCat("Source file '", source->GetFullPath(), "' of target '",
1775 this->GetTargetName(), "' is a '", language,
1776 "' source but must be 'CXX' in order to have a BMI build "
1777 "statement generated."));
1778 return;
1779 }
1780
1781 std::string const sourceFilePath = this->GetCompiledSourceNinjaPath(source);
1782 std::string const targetSupportDir =
1783 this->ConvertToNinjaPath(this->GeneratorTarget->GetCMFSupportDirectory());
1784 std::string const bmiDir = this->ConvertToNinjaPath(
1785 cmStrCat(this->GeneratorTarget->GetSupportDirectory(),
1786 this->GetGlobalGenerator()->ConfigDirectory(config)));
1787 std::string const bmiFileName =
1788 this->ConvertToNinjaPath(this->GetBmiFilePath(source, config));
1789 std::string const bmiFileDir = cmSystemTools::GetFilenamePath(bmiFileName);
1790
1791 int const commandLineLengthLimit = this->ForceResponseFile() ? -1 : 0;
1792
1793 cmNinjaBuild bmiBuild(
1794 this->LanguageCompilerRule(language, config, WithScanning::Yes));
1795 cmNinjaVars& vars = bmiBuild.Variables;
1796 vars["FLAGS"] =
1797 this->ComputeFlagsForObject(source, language, config, bmiFileName);
1798 vars["DEFINES"] = this->ComputeDefines(source, language, config);
1799 vars["INCLUDES"] = this->ComputeIncludes(source, language, config);
1800 vars["CONFIG"] = config;
1801
1802 if (this->GetMakefile()->GetSafeDefinition(
1803 cmStrCat("CMAKE_", language, "_DEPFILE_FORMAT")) != "msvc"_s) {
1804 bool replaceExt = false;
1805 if (!language.empty()) {
1806 std::string repVar =
1807 cmStrCat("CMAKE_", language, "_DEPFILE_EXTENSION_REPLACE");
1808 replaceExt = this->Makefile->IsOn(repVar);
1809 }
1810 this->AddDepfileBinding(
1811 vars,
1812 replaceExt
1813 ? cmStrCat(bmiFileDir, '/',
1814 cmSystemTools::GetFilenameWithoutLastExtension(bmiFileName),
1815 ".d")
1816 : cmStrCat(bmiFileName, ".d"));
1817 }
1818
1819 std::string d =
1820 this->GeneratorTarget->GetClangTidyExportFixesDirectory(language);
1821 if (!d.empty()) {
1822 this->GlobalCommonGenerator->AddClangTidyExportFixesDir(d);
1823 std::string fixesFile =

Callers 1

Calls 15

GetMakefileMethod · 0.95
GetTargetNameMethod · 0.95
GetGlobalGeneratorMethod · 0.95
GetBmiFilePathMethod · 0.95
ForceResponseFileMethod · 0.95
LanguageCompilerRuleMethod · 0.95
ComputeFlagsForObjectMethod · 0.95
ComputeDefinesMethod · 0.95
ComputeIncludesMethod · 0.95
AddDepfileBindingMethod · 0.95

Tested by

no test coverage detected