| 827 | } |
| 828 | |
| 829 | void 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 | |
| 884 | void cmLocalUnixMakefileGenerator3::WriteConvenienceRule( |
| 885 | std::ostream& ruleFileStream, std::string const& realTarget, |
no test coverage detected