| 105 | } |
| 106 | |
| 107 | cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, cmMakefile* makefile) |
| 108 | : cmOutputConverter(makefile->GetStateSnapshot()) |
| 109 | , DirectoryBacktrace(makefile->GetBacktrace()) |
| 110 | { |
| 111 | this->GlobalGenerator = gg; |
| 112 | |
| 113 | this->Makefile = makefile; |
| 114 | |
| 115 | this->AliasTargets = makefile->GetAliasTargets(); |
| 116 | |
| 117 | this->EmitUniversalBinaryFlags = true; |
| 118 | |
| 119 | this->ComputeObjectMaxPath(); |
| 120 | |
| 121 | // Canonicalize entries of the CPATH environment variable the same |
| 122 | // way detection of CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES does. |
| 123 | { |
| 124 | std::vector<std::string> cpath; |
| 125 | cmSystemTools::GetPath(cpath, "CPATH"); |
| 126 | for (std::string const& cp : cpath) { |
| 127 | if (cmSystemTools::FileIsFullPath(cp)) { |
| 128 | this->EnvCPATH.emplace_back(cmSystemTools::CollapseFullPath(cp)); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | std::vector<std::string> enabledLanguages = |
| 134 | this->GetState()->GetEnabledLanguages(); |
| 135 | |
| 136 | if (cmValue sysrootCompile = |
| 137 | this->Makefile->GetDefinition("CMAKE_SYSROOT_COMPILE")) { |
| 138 | this->CompilerSysroot = *sysrootCompile; |
| 139 | } else { |
| 140 | this->CompilerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); |
| 141 | } |
| 142 | |
| 143 | if (cmValue sysrootLink = |
| 144 | this->Makefile->GetDefinition("CMAKE_SYSROOT_LINK")) { |
| 145 | this->LinkerSysroot = *sysrootLink; |
| 146 | } else { |
| 147 | this->LinkerSysroot = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"); |
| 148 | } |
| 149 | |
| 150 | // OSX SYSROOT can be required by some tools, like tapi |
| 151 | { |
| 152 | cmValue osxSysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); |
| 153 | this->VariableMappings["CMAKE_OSX_SYSROOT"] = |
| 154 | osxSysroot.IsEmpty() ? "/" : this->EscapeForShell(*osxSysroot, true); |
| 155 | } |
| 156 | |
| 157 | if (cmValue appleArchSysroots = |
| 158 | this->Makefile->GetDefinition("CMAKE_APPLE_ARCH_SYSROOTS")) { |
| 159 | std::string const& appleArchs = |
| 160 | this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES"); |
| 161 | cmList archs(appleArchs); |
| 162 | cmList sysroots{ appleArchSysroots, cmList::EmptyElements::Yes }; |
| 163 | if (archs.size() == sysroots.size()) { |
| 164 | for (cmList::size_type i = 0; i < archs.size(); ++i) { |
nothing calls this directly
no test coverage detected