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

Method CreateXCodeDependHackMakefile

Source/cmGlobalXCodeGenerator.cxx:5019–5138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5017}
5018
5019void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
5020 std::vector<cmXCodeObject*>& targets)
5021{
5022 cmGeneratedFileStream makefileStream(this->CurrentXCodeHackMakefile);
5023 if (!makefileStream) {
5024 cmSystemTools::Error(
5025 cmStrCat("Could not create ", this->CurrentXCodeHackMakefile));
5026 return;
5027 }
5028 makefileStream.SetCopyIfDifferent(true);
5029 // one more pass for external depend information not handled
5030 // correctly by xcode
5031 /* clang-format off */
5032 makefileStream << "# DO NOT EDIT\n"
5033 "# This makefile makes sure all linkable targets are\n"
5034 "# up-to-date with anything they link to\n"
5035 "default:\n"
5036 "\techo \"Do not invoke directly\"\n"
5037 "\n";
5038 /* clang-format on */
5039
5040 std::set<std::string> dummyRules;
5041
5042 // Write rules to help Xcode relink things at the right time.
5043 /* clang-format off */
5044 makefileStream <<
5045 "# Rules to remove targets that are older than anything to which they\n"
5046 "# link. This forces Xcode to relink the targets from scratch. It\n"
5047 "# does not seem to check these dependencies itself.\n";
5048 /* clang-format on */
5049 for (auto const& configName : this->CurrentConfigurationTypes) {
5050 for (auto* target : targets) {
5051 cmGeneratorTarget* gt = target->GetTarget();
5052
5053 if (gt->GetType() == cmStateEnums::EXECUTABLE ||
5054 gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
5055 gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
5056 gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
5057 gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
5058 // Declare an entry point for the target post-build phase.
5059 makefileStream << this->PostBuildMakeTarget(gt->GetName(), configName)
5060 << ":\n";
5061 }
5062
5063 if (gt->GetType() == cmStateEnums::EXECUTABLE ||
5064 gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
5065 gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
5066 gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
5067 std::string tfull = gt->GetFullPath(configName);
5068 std::string trel = ConvertToMakefilePath(tfull);
5069
5070 // Add this target to the post-build phases of its dependencies.
5071 auto const y = target->GetDependTargets().find(configName);
5072 if (y != target->GetDependTargets().end()) {
5073 for (auto const& deptgt : y->second) {
5074 makefileStream << this->PostBuildMakeTarget(deptgt, configName)
5075 << ": " << trel << '\n';
5076 }

Callers 1

CreateXCodeObjectsMethod · 0.95

Calls 15

PostBuildMakeTargetMethod · 0.95
GetTargetTempDirMethod · 0.95
ConvertToMakefilePathFunction · 0.85
SetCopyIfDifferentMethod · 0.80
ErrorClass · 0.70
cmStrCatFunction · 0.70
GetTargetMethod · 0.45
GetTypeMethod · 0.45
GetNameMethod · 0.45
GetFullPathMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected