diff options
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 016653b..8be015e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -425,27 +425,25 @@ void cmLocalGenerator::ProcessEvaluationFiles( void cmLocalGenerator::GenerateInstallRules() { // Compute the install prefix. - const char* prefix = - cmToCStr(this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX")); + cmProp installPrefix = this->Makefile->GetDefinition("CMAKE_INSTALL_PREFIX"); + std::string prefix = installPrefix; #if defined(_WIN32) && !defined(__CYGWIN__) - std::string prefix_win32; - if (!prefix) { - if (!cmSystemTools::GetEnv("SystemDrive", prefix_win32)) { - prefix_win32 = "C:"; + if (!installPrefix) { + if (!cmSystemTools::GetEnv("SystemDrive", prefix)) { + prefix = "C:"; } cmProp project_name = this->Makefile->GetDefinition("PROJECT_NAME"); if (cmNonempty(project_name)) { - prefix_win32 += "/Program Files/"; - prefix_win32 += *project_name; + prefix += "/Program Files/"; + prefix += *project_name; } else { - prefix_win32 += "/InstalledCMakeProject"; + prefix += "/InstalledCMakeProject"; } - prefix = prefix_win32.c_str(); } #elif defined(__HAIKU__) char dir[B_PATH_NAME_LENGTH]; - if (!prefix) { + if (!installPrefix) { if (find_directory(B_SYSTEM_DIRECTORY, -1, false, dir, sizeof(dir)) == B_OK) { prefix = dir; @@ -454,13 +452,13 @@ void cmLocalGenerator::GenerateInstallRules() } } #else - if (!prefix) { + if (!installPrefix) { prefix = "/usr/local"; } #endif if (cmProp stagingPrefix = this->Makefile->GetDefinition("CMAKE_STAGING_PREFIX")) { - prefix = stagingPrefix->c_str(); + prefix = *stagingPrefix; } // Compute the set of configurations. @@ -1869,17 +1867,17 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( } bool cmLocalGenerator::AllAppleArchSysrootsAreTheSame( - const std::vector<std::string>& archs, const char* sysroot) + const std::vector<std::string>& archs, cmProp sysroot) { if (!sysroot) { return false; } return std::all_of(archs.begin(), archs.end(), - [this, &sysroot](std::string const& arch) -> bool { + [this, sysroot](std::string const& arch) -> bool { std::string const& archSysroot = this->AppleArchSysroots[arch]; - return cmIsOff(archSysroot) || archSysroot == sysroot; + return cmIsOff(archSysroot) || sysroot == archSysroot; }); } @@ -1912,7 +1910,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, cmProp sysrootFlag = this->Makefile->GetDefinition(sysrootFlagVar); if (cmNonempty(sysrootFlag)) { if (!this->AppleArchSysroots.empty() && - !this->AllAppleArchSysrootsAreTheSame(archs, cmToCStr(sysroot))) { + !this->AllAppleArchSysrootsAreTheSame(archs, sysroot)) { for (std::string const& arch : archs) { std::string const& archSysroot = this->AppleArchSysroots[arch]; if (cmIsOff(archSysroot)) { @@ -2570,10 +2568,10 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) continue; } - const std::string pchExtension = - this->Makefile->GetSafeDefinition("CMAKE_PCH_EXTENSION"); + cmProp pchExtension = + this->Makefile->GetDefinition("CMAKE_PCH_EXTENSION"); - if (pchExtension.empty()) { + if (pchExtension.IsEmpty()) { continue; } @@ -2664,7 +2662,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target) } } } else { - pch_sf->SetProperty("PCH_EXTENSION", pchExtension.c_str()); + pch_sf->SetProperty("PCH_EXTENSION", pchExtension); } // Add pchHeader to source files, which will @@ -2805,7 +2803,7 @@ inline void RegisterUnitySources(cmGeneratorTarget* target, cmSourceFile* sf, std::string const& filename) { target->AddSourceFileToUnityBatch(sf->ResolveFullPath()); - sf->SetProperty("UNITY_SOURCE_FILE", filename.c_str()); + sf->SetProperty("UNITY_SOURCE_FILE", filename); } } @@ -3003,7 +3001,7 @@ void cmLocalGenerator::AddUnityBuild(cmGeneratorTarget* target) auto* unity = this->GetMakefile()->GetOrCreateSource(file); target->AddSource(file, true); unity->SetProperty("SKIP_UNITY_BUILD_INCLUSION", "ON"); - unity->SetProperty("UNITY_SOURCE_FILE", file.c_str()); + unity->SetProperty("UNITY_SOURCE_FILE", file); } } } |