Merge topic 'use-GetCMakeRoot'
3144857e
Avoid depending on CMAKE_ROOT cache entry internally (#16015)
This commit is contained in:
commit
d9fc4dfe3c
|
@ -78,8 +78,7 @@ bool cmCreateTestSourceList
|
||||||
driver += *i;
|
driver += *i;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
std::string configFile =
|
std::string configFile = cmSystemTools::GetCMakeRoot();
|
||||||
this->Makefile->GetRequiredDefinition("CMAKE_ROOT");
|
|
||||||
|
|
||||||
configFile += "/Templates/TestDriver.cxx.in";
|
configFile += "/Templates/TestDriver.cxx.in";
|
||||||
// Create the test driver file
|
// Create the test driver file
|
||||||
|
|
|
@ -259,13 +259,12 @@ void cmExtraCodeBlocksGenerator
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert
|
// Convert
|
||||||
const char* cmakeRoot = mf->GetDefinition("CMAKE_ROOT");
|
|
||||||
for (std::vector<std::string>::const_iterator jt = listFiles.begin();
|
for (std::vector<std::string>::const_iterator jt = listFiles.begin();
|
||||||
jt != listFiles.end();
|
jt != listFiles.end();
|
||||||
++jt)
|
++jt)
|
||||||
{
|
{
|
||||||
// don't put cmake's own files into the project (#12110):
|
// don't put cmake's own files into the project (#12110):
|
||||||
if (jt->find(cmakeRoot) == 0)
|
if (jt->find(cmSystemTools::GetCMakeRoot()) == 0)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3909,8 +3909,7 @@ void checkPropertyConsistency(cmGeneratorTarget const* depender,
|
||||||
|
|
||||||
std::vector<std::string> props;
|
std::vector<std::string> props;
|
||||||
cmSystemTools::ExpandListArgument(prop, props);
|
cmSystemTools::ExpandListArgument(prop, props);
|
||||||
std::string pdir =
|
std::string pdir = cmSystemTools::GetCMakeRoot();
|
||||||
dependee->Target->GetMakefile()->GetRequiredDefinition("CMAKE_ROOT");
|
|
||||||
pdir += "/Help/prop_tgt/";
|
pdir += "/Help/prop_tgt/";
|
||||||
|
|
||||||
for(std::vector<std::string>::iterator pi = props.begin();
|
for(std::vector<std::string>::iterator pi = props.begin();
|
||||||
|
|
|
@ -820,7 +820,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
||||||
// Now load files that can override any settings on the platform or for
|
// Now load files that can override any settings on the platform or for
|
||||||
// the project First load the project compatibility file if it is in
|
// the project First load the project compatibility file if it is in
|
||||||
// cmake
|
// cmake
|
||||||
std::string projectCompatibility = mf->GetDefinition("CMAKE_ROOT");
|
std::string projectCompatibility = cmSystemTools::GetCMakeRoot();
|
||||||
projectCompatibility += "/Modules/";
|
projectCompatibility += "/Modules/";
|
||||||
projectCompatibility += mf->GetSafeDefinition("PROJECT_NAME");
|
projectCompatibility += mf->GetSafeDefinition("PROJECT_NAME");
|
||||||
projectCompatibility += "Compatibility.cmake";
|
projectCompatibility += "Compatibility.cmake";
|
||||||
|
|
|
@ -184,12 +184,11 @@ void RegisterVisualStudioMacros(const std::string& macrosFile,
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
|
void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
|
||||||
{
|
{
|
||||||
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
|
|
||||||
std::string dir = this->GetUserMacrosDirectory();
|
std::string dir = this->GetUserMacrosDirectory();
|
||||||
|
|
||||||
if (dir != "")
|
if (dir != "")
|
||||||
{
|
{
|
||||||
std::string src = mf->GetRequiredDefinition("CMAKE_ROOT");
|
std::string src = cmSystemTools::GetCMakeRoot();
|
||||||
src += "/Templates/" CMAKE_VSMACROS_FILENAME;
|
src += "/Templates/" CMAKE_VSMACROS_FILENAME;
|
||||||
|
|
||||||
std::string dst = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME;
|
std::string dst = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME;
|
||||||
|
|
|
@ -3738,10 +3738,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always search in the standard modules location.
|
// Always search in the standard modules location.
|
||||||
const char* cmakeRoot = this->GetDefinition("CMAKE_ROOT");
|
moduleInCMakeRoot = cmSystemTools::GetCMakeRoot();
|
||||||
if(cmakeRoot)
|
|
||||||
{
|
|
||||||
moduleInCMakeRoot = cmakeRoot;
|
|
||||||
moduleInCMakeRoot += "/Modules/";
|
moduleInCMakeRoot += "/Modules/";
|
||||||
moduleInCMakeRoot += filename;
|
moduleInCMakeRoot += filename;
|
||||||
cmSystemTools::ConvertToUnixSlashes(moduleInCMakeRoot);
|
cmSystemTools::ConvertToUnixSlashes(moduleInCMakeRoot);
|
||||||
|
@ -3749,7 +3746,6 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
|
||||||
{
|
{
|
||||||
moduleInCMakeRoot = "";
|
moduleInCMakeRoot = "";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Normally, prefer the files found in CMAKE_MODULE_PATH. Only when the file
|
// Normally, prefer the files found in CMAKE_MODULE_PATH. Only when the file
|
||||||
// from which we are being called is located itself in CMAKE_ROOT, then
|
// from which we are being called is located itself in CMAKE_ROOT, then
|
||||||
|
@ -3763,7 +3759,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
|
||||||
if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty())
|
if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty())
|
||||||
{
|
{
|
||||||
const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
|
const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
|
||||||
std::string mods = cmakeRoot + std::string("/Modules/");
|
std::string mods = cmSystemTools::GetCMakeRoot() + "/Modules/";
|
||||||
if (currentFile && strncmp(currentFile, mods.c_str(), mods.size()) == 0)
|
if (currentFile && strncmp(currentFile, mods.c_str(), mods.size()) == 0)
|
||||||
{
|
{
|
||||||
switch (this->GetPolicyStatus(cmPolicies::CMP0017))
|
switch (this->GetPolicyStatus(cmPolicies::CMP0017))
|
||||||
|
|
|
@ -1003,8 +1003,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
|
||||||
SetupAutoRccTarget(target);
|
SetupAutoRccTarget(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
|
std::string inputFile = cmSystemTools::GetCMakeRoot();
|
||||||
std::string inputFile = cmakeRoot;
|
|
||||||
inputFile += "/Modules/AutogenInfo.cmake.in";
|
inputFile += "/Modules/AutogenInfo.cmake.in";
|
||||||
std::string outputFile = targetDir;
|
std::string outputFile = targetDir;
|
||||||
outputFile += "/AutogenInfo.cmake";
|
outputFile += "/AutogenInfo.cmake";
|
||||||
|
|
|
@ -2409,8 +2409,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
|
||||||
|
|
||||||
// we have to find the module directory, so we can copy the files
|
// we have to find the module directory, so we can copy the files
|
||||||
this->AddCMakePaths();
|
this->AddCMakePaths();
|
||||||
std::string modulesPath =
|
std::string modulesPath = cmSystemTools::GetCMakeRoot();
|
||||||
this->State->GetInitializedCacheValue("CMAKE_ROOT");
|
|
||||||
modulesPath += "/Modules";
|
modulesPath += "/Modules";
|
||||||
std::string inFile = modulesPath;
|
std::string inFile = modulesPath;
|
||||||
inFile += "/SystemInformation.cmake";
|
inFile += "/SystemInformation.cmake";
|
||||||
|
|
Loading…
Reference in New Issue