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

Method GenerateInstallRules

Source/cmLocalGenerator.cxx:461–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461void cmLocalGenerator::GenerateInstallRules()
462{
463 // Compute the install prefix.
464 cmValue installPrefix =
465 this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX");
466 std::string prefix = *installPrefix;
467
468#if defined(_WIN32) && !defined(__CYGWIN__)
469 if (!installPrefix) {
470 if (!cmSystemTools::GetEnv("SystemDrive", prefix)) {
471 prefix = "C:";
472 }
473 cmValue project_name = this->Makefile->GetDefinition("PROJECT_NAME");
474 if (cmNonempty(project_name)) {
475 prefix += "/Program Files/";
476 prefix += *project_name;
477 } else {
478 prefix += "/InstalledCMakeProject";
479 }
480 }
481#elif defined(__HAIKU__)
482 char dir[B_PATH_NAME_LENGTH];
483 if (!installPrefix) {
484 if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir)) ==
485 B_OK) {
486 prefix = dir;
487 } else {
488 prefix = "/boot/system";
489 }
490 }
491#else
492 if (!installPrefix) {
493 prefix = "/usr/local";
494 }
495#endif
496 if (cmValue stagingPrefix =
497 this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX")) {
498 prefix = *stagingPrefix;
499 }
500
501 // Compute the set of configurations.
502 std::vector<std::string> configurationTypes =
503 this->Makefile->GetGeneratorConfigs(cmMakefile::OnlyMultiConfig);
504 std::string config = this->Makefile->GetDefaultConfiguration();
505
506 // Choose a default install configuration.
507 std::string default_config = config;
508 char const* default_order[] = { "RELEASE", "MINSIZEREL", "RELWITHDEBINFO",
509 "DEBUG", nullptr };
510 for (char const** c = default_order; *c && default_config.empty(); ++c) {
511 for (std::string const& configurationType : configurationTypes) {
512 if (cmSystemTools::UpperCase(configurationType) == *c) {
513 default_config = configurationType;
514 }
515 }
516 }
517 if (default_config.empty() && !configurationTypes.empty()) {
518 default_config = configurationTypes[0];

Callers 1

GenerateMethod · 0.80

Calls 15

GetStateMethod · 0.95
GetGlobalGeneratorMethod · 0.95
GetPolicyStatusMethod · 0.95
IssueMessageMethod · 0.95
cmNonemptyFunction · 0.85
GetGeneratorConfigsMethod · 0.80
AddInstallScriptMethod · 0.80
strMethod · 0.80

Tested by

no test coverage detected