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

Method CreateReRunCMakeFile

Source/cmGlobalXCodeGenerator.cxx:842–904  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
843 cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens)
844{
845 std::vector<std::string> lfiles;
846 for (auto* gen : gens) {
847 cm::append(lfiles, gen->GetMakefile()->GetListFiles());
848 }
849
850 // sort the array
851 std::sort(lfiles.begin(), lfiles.end());
852 lfiles.erase(std::unique(lfiles.begin(), lfiles.end()), lfiles.end());
853
854 cmake* cm = this->GetCMakeInstance();
855 if (cm->DoWriteGlobVerifyTarget()) {
856 lfiles.emplace_back(cm->GetGlobVerifyStamp());
857 }
858
859 this->CurrentReRunCMakeMakefile =
860 cmStrCat(root->GetCurrentBinaryDirectory(), "/CMakeScripts");
861 cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile);
862 this->CurrentReRunCMakeMakefile += "/ReRunCMake.make";
863 cmGeneratedFileStream makefileStream(this->CurrentReRunCMakeMakefile);
864 makefileStream.SetCopyIfDifferent(true);
865 makefileStream << "# Generated by CMake, DO NOT EDIT\n\n"
866
867 "TARGETS:= \n"
868 "empty:= \n"
869 "space:= $(empty) $(empty)\n"
870 "spaceplus:= $(empty)\\ $(empty)\n\n";
871
872 for (auto const& lfile : lfiles) {
873 makefileStream << "TARGETS += $(subst $(space),$(spaceplus),$(wildcard "
874 << ConvertToMakefilePath(lfile) << "))\n";
875 }
876 makefileStream << '\n';
877
878 std::string checkCache =
879 cmStrCat(root->GetBinaryDirectory(), "/CMakeFiles/cmake.check_cache");
880
881 if (cm->DoWriteGlobVerifyTarget()) {
882 makefileStream << ".NOTPARALLEL:\n\n"
883 ".PHONY: all VERIFY_GLOBS\n\n"
884 "all: VERIFY_GLOBS "
885 << ConvertToMakefilePath(checkCache)
886 << "\n\n"
887 "VERIFY_GLOBS:\n"
888 "\t"
889 << ConvertToMakefilePath(cmSystemTools::GetCMakeCommand())
890 << " -P "
891 << ConvertToMakefilePath(cm->GetGlobVerifyScript())
892 << "\n\n";
893 }
894
895 makefileStream << ConvertToMakefilePath(checkCache) << ": $(TARGETS)\n";
896 makefileStream
897 << '\t' << ConvertToMakefilePath(cmSystemTools::GetCMakeCommand()) << " -S"
898 << ConvertToMakefilePath(root->GetSourceDirectory()) << " -B"
899 << ConvertToMakefilePath(root->GetBinaryDirectory())

Callers 1

AddExtraTargetsMethod · 0.95

Calls 13

appendFunction · 0.85
ConvertToMakefilePathFunction · 0.85
eraseMethod · 0.80
emplace_backMethod · 0.80
SetCopyIfDifferentMethod · 0.80
cmStrCatFunction · 0.70
GetMakefileMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected