ENH: change expand variables to use GetDefinition
This commit is contained in:
parent
2858689d6d
commit
f709e5588e
@ -787,9 +787,9 @@ bool cmMakefile::IsOn(const char* name)
|
|||||||
return cmSystemTools::IsOn(value);
|
return cmSystemTools::IsOn(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmMakefile::GetDefinition(const char* name)
|
const char* cmMakefile::GetDefinition(const char* name) const
|
||||||
{
|
{
|
||||||
DefinitionMap::iterator pos = m_Definitions.find(name);
|
DefinitionMap::const_iterator pos = m_Definitions.find(name);
|
||||||
if(pos != m_Definitions.end())
|
if(pos != m_Definitions.end())
|
||||||
{
|
{
|
||||||
return (*pos).second.c_str();
|
return (*pos).second.c_str();
|
||||||
@ -929,16 +929,16 @@ void cmMakefile::ExpandVariablesInString(std::string& source,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DefinitionMap::const_iterator pos = m_Definitions.find(var.c_str());
|
const char* lookup = this->GetDefinition(var.c_str());
|
||||||
if(pos != m_Definitions.end())
|
if(lookup)
|
||||||
{
|
{
|
||||||
if (escapeQuotes)
|
if (escapeQuotes)
|
||||||
{
|
{
|
||||||
result += cmSystemTools::EscapeQuotes((*pos).second.c_str());
|
result += cmSystemTools::EscapeQuotes(lookup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result += (*pos).second;
|
result += lookup;
|
||||||
}
|
}
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +452,7 @@ public:
|
|||||||
* If the variable is not found in this makefile instance, the
|
* If the variable is not found in this makefile instance, the
|
||||||
* cache is then queried.
|
* cache is then queried.
|
||||||
*/
|
*/
|
||||||
const char* GetDefinition(const char*);
|
const char* GetDefinition(const char*) const;
|
||||||
|
|
||||||
/** Test a boolean cache entry to see if it is true or false,
|
/** Test a boolean cache entry to see if it is true or false,
|
||||||
* returns false if no entry defined.
|
* returns false if no entry defined.
|
||||||
|
@ -1370,27 +1370,31 @@ void cmUnixMakefileGenerator::ComputeSystemInfo()
|
|||||||
{
|
{
|
||||||
if (m_CacheOnly)
|
if (m_CacheOnly)
|
||||||
{
|
{
|
||||||
if(m_Makefile->GetDefinition("CMAKE_CXX_COMPILER"))
|
if(m_Makefile->GetDefinition("CMAKE_CXX_COMPILER"))
|
||||||
{
|
{
|
||||||
std::string env = "CXX=${CMAKE_CXX_COMPILER}";
|
std::string env = "CXX=${CMAKE_CXX_COMPILER}";
|
||||||
m_Makefile->ExpandVariablesInString(env);
|
m_Makefile->ExpandVariablesInString(env);
|
||||||
putenv(const_cast<char*>(env.c_str()));
|
std::cout << "Setting: " << env.c_str() << "\n";
|
||||||
env = "CC=${CMAKE_C_COMPILER}";
|
putenv(const_cast<char*>(env.c_str()));
|
||||||
m_Makefile->ExpandVariablesInString(env);
|
}
|
||||||
putenv(const_cast<char*>(env.c_str()));
|
if(m_Makefile->GetDefinition("CMAKE_C_COMPILER"))
|
||||||
}
|
{
|
||||||
|
std::string env = "CC=${CMAKE_C_COMPILER}";
|
||||||
// currently we run configure shell script here to determine the info
|
m_Makefile->ExpandVariablesInString(env);
|
||||||
std::string output;
|
std::cout << "Setting: " << env.c_str() << "\n";
|
||||||
std::string cmd = "cd ";
|
putenv(const_cast<char*>(env.c_str()));
|
||||||
cmd += m_Makefile->GetHomeOutputDirectory();
|
}
|
||||||
cmd += "; ";
|
// currently we run configure shell script here to determine the info
|
||||||
const char* root
|
std::string output;
|
||||||
= m_Makefile->GetDefinition("CMAKE_ROOT");
|
std::string cmd = "cd ";
|
||||||
cmd += root;
|
cmd += m_Makefile->GetHomeOutputDirectory();
|
||||||
cmd += "/Templates/configure";
|
cmd += "; ";
|
||||||
cmSystemTools::RunCommand(cmd.c_str(), output);
|
const char* root
|
||||||
m_Makefile->AddDefinition("RUN_CONFIGURE", true);
|
= m_Makefile->GetDefinition("CMAKE_ROOT");
|
||||||
|
cmd += root;
|
||||||
|
cmd += "/Templates/configure";
|
||||||
|
cmSystemTools::RunCommand(cmd.c_str(), output);
|
||||||
|
m_Makefile->AddDefinition("RUN_CONFIGURE", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now load the settings
|
// now load the settings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user