Use new AddCacheEntry signatures

This commit is contained in:
Marc Chevrier
2021-09-02 18:42:21 +02:00
parent 3c2e58eeb8
commit f84193292c
10 changed files with 47 additions and 56 deletions
+4 -4
View File
@@ -232,17 +232,17 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
// before writing the cache, update the version numbers
// to the
this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION",
std::to_string(cmVersion::GetMajorVersion()).c_str(),
std::to_string(cmVersion::GetMajorVersion()),
"Major version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION",
std::to_string(cmVersion::GetMinorVersion()).c_str(),
std::to_string(cmVersion::GetMinorVersion()),
"Minor version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION",
std::to_string(cmVersion::GetPatchVersion()).c_str(),
std::to_string(cmVersion::GetPatchVersion()),
"Patch version of cmake used to create the "
"current loaded cache",
cmStateEnums::INTERNAL);
@@ -256,7 +256,7 @@ bool cmCacheManager::SaveCache(const std::string& path, cmMessenger* messenger)
currentcwd[0] = static_cast<char>(currentcwd[0] - 'A' + 'a');
}
cmSystemTools::ConvertToUnixSlashes(currentcwd);
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(),
this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd,
"This is the directory where this CMakeCache.txt"
" was created",
cmStateEnums::INTERNAL);
+2 -2
View File
@@ -358,8 +358,8 @@ void cmFindBase::NormalizeFindResult()
// value.
if (value != *existingValue || this->AlreadyInCacheWithoutMetaInfo) {
this->Makefile->GetCMakeInstance()->AddCacheEntry(
this->VariableName, value.c_str(),
this->VariableDocumentation.c_str(), this->VariableType);
this->VariableName, value, this->VariableDocumentation.c_str(),
this->VariableType);
if (this->Makefile->GetPolicyStatus(cmPolicies::CMP0126) ==
cmPolicies::NEW) {
if (this->Makefile->IsNormalDefinitionSet(this->VariableName)) {
+1 -1
View File
@@ -117,7 +117,7 @@ std::string cmGlobalCommonGenerator::GetEditCacheCommand() const
editCacheCommand = cmSystemTools::GetCMakeGUICommand();
}
if (!editCacheCommand.empty()) {
cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand,
"Path to cache edit program executable.",
cmStateEnums::INTERNAL);
}
+2 -3
View File
@@ -2191,9 +2191,8 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator* gen,
this->TryCompileOuterMakefile = mf;
cmProp make =
gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", cmToCStr(make),
"make program",
cmStateEnums::FILEPATH);
this->GetCMakeInstance()->AddCacheEntry(
"CMAKE_MAKE_PROGRAM", make, "make program", cmStateEnums::FILEPATH);
// copy the enabled languages
this->GetCMakeInstance()->GetState()->SetEnabledLanguages(
gen->GetCMakeInstance()->GetState()->GetEnabledLanguages());
@@ -467,9 +467,9 @@ bool cmGlobalVisualStudioVersionedGenerator::SetGeneratorInstance(
// Save the selected instance persistently.
std::string genInstance = mf->GetSafeDefinition("CMAKE_GENERATOR_INSTANCE");
if (vsInstance != genInstance) {
this->CMakeInstance->AddCacheEntry(
"CMAKE_GENERATOR_INSTANCE", vsInstance.c_str(),
"Generator instance identifier.", cmStateEnums::INTERNAL);
this->CMakeInstance->AddCacheEntry("CMAKE_GENERATOR_INSTANCE", vsInstance,
"Generator instance identifier.",
cmStateEnums::INTERNAL);
}
return true;
+2 -3
View File
@@ -3241,9 +3241,8 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
return *storedGUID;
}
this->CMakeInstance->AddCacheEntry(guidStoreName, id.c_str(),
"Stored Xcode object GUID",
cmStateEnums::INTERNAL);
this->CMakeInstance->AddCacheEntry(
guidStoreName, id, "Stored Xcode object GUID", cmStateEnums::INTERNAL);
return id;
}
+2 -3
View File
@@ -77,9 +77,8 @@ bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
if (!customGuid.empty()) {
std::string guidVariable = utility_name + "_GUID_CMAKE";
mf.GetCMakeInstance()->AddCacheEntry(guidVariable, customGuid.c_str(),
"Stored GUID",
cmStateEnums::INTERNAL);
mf.GetCMakeInstance()->AddCacheEntry(
guidVariable, customGuid, "Stored GUID", cmStateEnums::INTERNAL);
}
// Create a target instance for this utility.
+1 -1
View File
@@ -2142,7 +2142,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID(
std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE");
// save the GUID in the cache
this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry(
guidStoreName, parser.GUID.c_str(), "Stored GUID", cmStateEnums::INTERNAL);
guidStoreName, parser.GUID, "Stored GUID", cmStateEnums::INTERNAL);
}
std::string cmLocalVisualStudio7Generator::GetTargetDirectory(
+4 -4
View File
@@ -1955,7 +1955,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
nvalue += files[cc];
}
this->GetCMakeInstance()->AddCacheEntry(name, nvalue.c_str(), doc, type);
this->GetCMakeInstance()->AddCacheEntry(name, nvalue, doc, type);
nvalue = *this->GetState()->GetInitializedCacheValue(name);
value = nvalue.c_str();
}
@@ -3589,13 +3589,13 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// Tell the single-configuration generator which one to use.
// Add this before the user-provided CMake arguments in case
// one of the arguments is -DCMAKE_BUILD_TYPE=...
cm.AddCacheEntry("CMAKE_BUILD_TYPE", config->c_str(),
"Build configuration", cmStateEnums::STRING);
cm.AddCacheEntry("CMAKE_BUILD_TYPE", config, "Build configuration",
cmStateEnums::STRING);
}
}
cmProp recursionDepth = this->GetDefinition("CMAKE_MAXIMUM_RECURSION_DEPTH");
if (recursionDepth) {
cm.AddCacheEntry("CMAKE_MAXIMUM_RECURSION_DEPTH", recursionDepth->c_str(),
cm.AddCacheEntry("CMAKE_MAXIMUM_RECURSION_DEPTH", recursionDepth,
"Maximum recursion depth", cmStateEnums::STRING);
}
// if cmake args were provided then pass them in
+26 -32
View File
@@ -605,9 +605,8 @@ void cmake::ProcessCacheArg(const std::string& var, const std::string& value,
}
}
this->AddCacheEntry(var, value.c_str(),
"No help, variable specified on the command line.",
type);
this->AddCacheEntry(
var, value, "No help, variable specified on the command line.", type);
if (this->WarnUnusedCli) {
if (!haveValue ||
@@ -1517,16 +1516,15 @@ void cmake::SetDirectoriesFromFile(const std::string& arg)
int cmake::AddCMakePaths()
{
// Save the value in the cache
this->AddCacheEntry("CMAKE_COMMAND",
cmSystemTools::GetCMakeCommand().c_str(),
this->AddCacheEntry("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand(),
"Path to CMake executable.", cmStateEnums::INTERNAL);
#ifndef CMAKE_BOOTSTRAP
this->AddCacheEntry(
"CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(),
"Path to ctest program executable.", cmStateEnums::INTERNAL);
this->AddCacheEntry(
"CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(),
"Path to cpack program executable.", cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand(),
"Path to ctest program executable.",
cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand(),
"Path to cpack program executable.",
cmStateEnums::INTERNAL);
#endif
if (!cmSystemTools::FileExists(
(cmSystemTools::GetCMakeRoot() + "/Modules/CMake.cmake"))) {
@@ -1538,7 +1536,7 @@ int cmake::AddCMakePaths()
cmSystemTools::GetCMakeRoot());
return 0;
}
this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(),
this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot(),
"Path to CMake installation.", cmStateEnums::INTERNAL);
return 1;
@@ -1886,7 +1884,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
this->LoadCache();
// restore the changed compilers
for (SaveCacheEntry const& i : saved) {
this->AddCacheEntry(i.key, i.value.c_str(), i.help.c_str(), i.type);
this->AddCacheEntry(i.key, i.value, i.help.c_str(), i.type);
}
cmSystemTools::Message(warning.str());
// avoid reconfigure if there were errors
@@ -1993,7 +1991,7 @@ int cmake::ActualConfigure()
}
if (!res) {
this->AddCacheEntry(
"CMAKE_HOME_DIRECTORY", this->GetHomeDirectory().c_str(),
"CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(),
"Source directory with the top level CMakeLists.txt file for this "
"project",
cmStateEnums::INTERNAL);
@@ -2038,19 +2036,17 @@ int cmake::ActualConfigure()
}
}
if (!this->State->GetInitializedCacheValue("CMAKE_GENERATOR")) {
this->AddCacheEntry("CMAKE_GENERATOR",
this->GlobalGenerator->GetName().c_str(),
this->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName(),
"Name of generator.", cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
this->GlobalGenerator->GetExtraGeneratorName().c_str(),
"Name of external makefile project generator.",
cmStateEnums::INTERNAL);
this->AddCacheEntry(
"CMAKE_EXTRA_GENERATOR", this->GlobalGenerator->GetExtraGeneratorName(),
"Name of external makefile project generator.", cmStateEnums::INTERNAL);
if (!this->State->GetInitializedCacheValue("CMAKE_TOOLCHAIN_FILE")) {
std::string envToolchain;
if (cmSystemTools::GetEnv("CMAKE_TOOLCHAIN_FILE", envToolchain) &&
!envToolchain.empty()) {
this->AddCacheEntry("CMAKE_TOOLCHAIN_FILE", envToolchain.c_str(),
this->AddCacheEntry("CMAKE_TOOLCHAIN_FILE", envToolchain,
"The CMake toolchain file",
cmStateEnums::FILEPATH);
}
@@ -2069,9 +2065,9 @@ int cmake::ActualConfigure()
return -2;
}
} else {
this->AddCacheEntry(
"CMAKE_GENERATOR_INSTANCE", this->GeneratorInstance.c_str(),
"Generator instance identifier.", cmStateEnums::INTERNAL);
this->AddCacheEntry("CMAKE_GENERATOR_INSTANCE", this->GeneratorInstance,
"Generator instance identifier.",
cmStateEnums::INTERNAL);
}
if (cmProp platformName =
@@ -2087,8 +2083,7 @@ int cmake::ActualConfigure()
return -2;
}
} else {
this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM",
this->GeneratorPlatform.c_str(),
this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform,
"Name of generator platform.", cmStateEnums::INTERNAL);
}
@@ -2104,8 +2099,7 @@ int cmake::ActualConfigure()
return -2;
}
} else {
this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET",
this->GeneratorToolset.c_str(),
this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset,
"Name of generator toolset.", cmStateEnums::INTERNAL);
}
@@ -3540,7 +3534,7 @@ void cmake::SetSuppressDevWarnings(bool b)
value = "FALSE";
}
this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value.c_str(),
this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value,
"Suppress Warnings that are meant for"
" the author of the CMakeLists.txt files.",
cmStateEnums::INTERNAL);
@@ -3564,7 +3558,7 @@ void cmake::SetSuppressDeprecatedWarnings(bool b)
value = "TRUE";
}
this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value.c_str(),
this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value,
"Whether to issue warnings for deprecated "
"functionality.",
cmStateEnums::INTERNAL);
@@ -3588,7 +3582,7 @@ void cmake::SetDevWarningsAsErrors(bool b)
value = "TRUE";
}
this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value.c_str(),
this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value,
"Suppress errors that are meant for"
" the author of the CMakeLists.txt files.",
cmStateEnums::INTERNAL);
@@ -3612,7 +3606,7 @@ void cmake::SetDeprecatedWarningsAsErrors(bool b)
value = "FALSE";
}
this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value.c_str(),
this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value,
"Whether to issue deprecation errors for macros"
" and functions.",
cmStateEnums::INTERNAL);