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

Method WriteSpecialTargetsBottom

Source/cmLocalUnixMakefileGenerator3.cxx:829–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827}
828
829void cmLocalUnixMakefileGenerator3::WriteSpecialTargetsBottom(
830 std::ostream& makefileStream)
831{
832 this->WriteDivider(makefileStream);
833 makefileStream << "# Special targets to cleanup operation of make.\n"
834 "\n";
835
836 // Write special "cmake_check_build_system" target to run cmake with
837 // the --check-build-system flag.
838 if (!this->GlobalGenerator->GlobalSettingIsOn(
839 "CMAKE_SUPPRESS_REGENERATION")) {
840 // Build command to run CMake to check if anything needs regenerating.
841 std::vector<std::string> commands;
842 cmake* cm = this->GlobalGenerator->GetCMakeInstance();
843 if (cm->DoWriteGlobVerifyTarget()) {
844 std::string rescanRule =
845 cmStrCat("$(CMAKE_COMMAND) -P ",
846 this->ConvertToOutputFormat(cm->GetGlobVerifyScript(),
847 cmOutputConverter::SHELL));
848 commands.push_back(rescanRule);
849 }
850 std::string cmakefileName = "CMakeFiles/Makefile.cmake";
851 std::string runRule = cmStrCat(
852 "$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) ",
853 cm->GetIgnoreCompileWarningAsError() ? "--compile-no-warning-as-error "
854 : "",
855 cm->GetIgnoreLinkWarningAsError() ? "--link-no-warning-as-error " : "",
856 "--check-build-system ",
857 this->ConvertToOutputFormat(cmakefileName, cmOutputConverter::SHELL),
858 " 0");
859
860 std::vector<std::string> no_depends;
861 commands.push_back(std::move(runRule));
862#ifndef CMAKE_BOOTSTRAP
863 // FIXME(#27079): This does not work for MSYS Makefiles.
864 if (this->GlobalGenerator->GetName() != "MSYS Makefiles") {
865 addInstrumentationCommand(this->GetCMakeInstance()->GetInstrumentation(),
866 commands);
867 }
868#endif
869 if (!this->IsRootMakefile()) {
870 this->CreateCDCommand(commands, this->GetBinaryDirectory(),
871 this->GetCurrentBinaryDirectory());
872 }
873 this->WriteMakeRule(makefileStream,
874 "Special rule to run CMake to check the build system "
875 "integrity.\n"
876 "No rule that depends on this can have "
877 "commands that come from listfiles\n"
878 "because they might be regenerated.",
879 "cmake_check_build_system", no_depends, commands,
880 true);
881 }
882}
883
884void cmLocalUnixMakefileGenerator3::WriteConvenienceRule(
885 std::ostream& ruleFileStream, std::string const& realTarget,

Callers 2

WriteLocalMakefileMethod · 0.95
WriteMainMakefile2Method · 0.80

Calls 15

WriteDividerMethod · 0.95
CreateCDCommandMethod · 0.95
WriteMakeRuleMethod · 0.95
moveFunction · 0.85
GlobalSettingIsOnMethod · 0.80
push_backMethod · 0.80
GetInstrumentationMethod · 0.80
cmStrCatFunction · 0.70
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected