| 300 | }; |
| 301 | |
| 302 | cmake::cmake(cmState::Role role, cmState::TryCompile isTryCompile) |
| 303 | : CMakeWorkingDirectory(cmSystemTools::GetLogicalWorkingDirectory()) |
| 304 | , FileTimeCache(cm::make_unique<cmFileTimeCache>()) |
| 305 | #ifndef CMAKE_BOOTSTRAP |
| 306 | , VariableWatch(cm::make_unique<cmVariableWatch>()) |
| 307 | #endif |
| 308 | , State(cm::make_unique<cmState>(role, isTryCompile)) |
| 309 | , Messenger(cm::make_unique<cmMessenger>()) |
| 310 | { |
| 311 | this->TraceFile.close(); |
| 312 | this->CurrentSnapshot = this->State->CreateBaseSnapshot(); |
| 313 | |
| 314 | #ifdef __APPLE__ |
| 315 | struct rlimit rlp; |
| 316 | if (!getrlimit(RLIMIT_STACK, &rlp)) { |
| 317 | if (rlp.rlim_cur != rlp.rlim_max) { |
| 318 | rlp.rlim_cur = rlp.rlim_max; |
| 319 | setrlimit(RLIMIT_STACK, &rlp); |
| 320 | } |
| 321 | } |
| 322 | #endif |
| 323 | |
| 324 | this->AddDefaultGenerators(); |
| 325 | this->AddDefaultExtraGenerators(); |
| 326 | if (role == cmState::Role::Project || role == cmState::Role::FindPackage || |
| 327 | role == cmState::Role::Script || role == cmState::Role::CTest || |
| 328 | role == cmState::Role::CPack) { |
| 329 | this->AddScriptingCommands(); |
| 330 | } |
| 331 | if (role == cmState::Role::Project || role == cmState::Role::FindPackage) { |
| 332 | this->AddProjectCommands(); |
| 333 | } |
| 334 | |
| 335 | if (role == cmState::Role::Project || role == cmState::Role::Help) { |
| 336 | this->LoadEnvironmentPresets(); |
| 337 | } |
| 338 | |
| 339 | // Make sure we can capture the build tool output. |
| 340 | cmSystemTools::EnableVSConsoleOutput(); |
| 341 | |
| 342 | // Set up a list of source and header extensions. |
| 343 | // These are used to find files when the extension is not given. |
| 344 | { |
| 345 | auto setupExts = [](FileExtensions& exts, |
| 346 | std::initializer_list<cm::string_view> extList) { |
| 347 | // Fill ordered vector |
| 348 | exts.ordered.reserve(extList.size()); |
| 349 | for (cm::string_view ext : extList) { |
| 350 | exts.ordered.emplace_back(ext); |
| 351 | } |
| 352 | // Fill unordered set |
| 353 | exts.unordered.insert(exts.ordered.begin(), exts.ordered.end()); |
| 354 | }; |
| 355 | |
| 356 | // The "c" extension MUST precede the "C" extension. |
| 357 | setupExts(this->CLikeSourceFileExtensions, |
| 358 | { "c", "C", "c++", "cc", "cpp", "cxx", "cu", "mpp", "m", "M", |
| 359 | "mm", "ixx", "cppm", "ccm", "cxxm", "c++m" }); |
nothing calls this directly
no test coverage detected