cmMakefile: Delegate storage of Home dirs to the cmake class.
There is no need to duplicate these on every cmMakefile.
This commit is contained in:
parent
397b629860
commit
410f39a43e
|
@ -181,11 +181,11 @@ void cmMakefile::Print() const
|
||||||
std::cout << " this->StartOutputDirectory; " <<
|
std::cout << " this->StartOutputDirectory; " <<
|
||||||
this->GetCurrentBinaryDirectory() << std::endl;
|
this->GetCurrentBinaryDirectory() << std::endl;
|
||||||
std::cout << " this->HomeOutputDirectory; " <<
|
std::cout << " this->HomeOutputDirectory; " <<
|
||||||
this->HomeOutputDirectory << std::endl;
|
this->GetHomeOutputDirectory() << std::endl;
|
||||||
std::cout << " this->cmStartDirectory; " <<
|
std::cout << " this->cmStartDirectory; " <<
|
||||||
this->GetCurrentSourceDirectory() << std::endl;
|
this->GetCurrentSourceDirectory() << std::endl;
|
||||||
std::cout << " this->cmHomeDirectory; " <<
|
std::cout << " this->cmHomeDirectory; " <<
|
||||||
this->cmHomeDirectory << std::endl;
|
this->GetHomeDirectory() << std::endl;
|
||||||
std::cout << " this->ProjectName; "
|
std::cout << " this->ProjectName; "
|
||||||
<< this->ProjectName << std::endl;
|
<< this->ProjectName << std::endl;
|
||||||
this->PrintStringVector("this->LinkDirectories", this->LinkDirectories);
|
this->PrintStringVector("this->LinkDirectories", this->LinkDirectories);
|
||||||
|
@ -3382,34 +3382,29 @@ cmMakefile::LexicalPushPop::~LexicalPushPop()
|
||||||
|
|
||||||
const char* cmMakefile::GetHomeDirectory() const
|
const char* cmMakefile::GetHomeDirectory() const
|
||||||
{
|
{
|
||||||
return this->cmHomeDirectory.c_str();
|
return this->GetCMakeInstance()->GetHomeDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::SetHomeDirectory(const std::string& dir)
|
void cmMakefile::SetHomeDirectory(const std::string& dir)
|
||||||
{
|
{
|
||||||
this->cmHomeDirectory = dir;
|
this->AddDefinition("CMAKE_SOURCE_DIR", dir.c_str());
|
||||||
cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory);
|
|
||||||
this->AddDefinition("CMAKE_SOURCE_DIR", this->GetHomeDirectory());
|
|
||||||
if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") )
|
if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") )
|
||||||
{
|
{
|
||||||
this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", this->GetHomeDirectory());
|
this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* cmMakefile::GetHomeOutputDirectory() const
|
const char* cmMakefile::GetHomeOutputDirectory() const
|
||||||
{
|
{
|
||||||
return this->HomeOutputDirectory.c_str();
|
return this->GetCMakeInstance()->GetHomeOutputDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::SetHomeOutputDirectory(const std::string& dir)
|
void cmMakefile::SetHomeOutputDirectory(const std::string& dir)
|
||||||
{
|
{
|
||||||
this->HomeOutputDirectory = dir;
|
this->AddDefinition("CMAKE_BINARY_DIR", dir.c_str());
|
||||||
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
|
|
||||||
this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory());
|
|
||||||
if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
|
if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
|
||||||
{
|
{
|
||||||
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
|
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir.c_str());
|
||||||
this->GetHomeOutputDirectory());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -878,8 +878,6 @@ protected:
|
||||||
|
|
||||||
std::string cmStartDirectory;
|
std::string cmStartDirectory;
|
||||||
std::string StartOutputDirectory;
|
std::string StartOutputDirectory;
|
||||||
std::string cmHomeDirectory;
|
|
||||||
std::string HomeOutputDirectory;
|
|
||||||
std::string cmCurrentListFile;
|
std::string cmCurrentListFile;
|
||||||
|
|
||||||
std::string ProjectName; // project name
|
std::string ProjectName; // project name
|
||||||
|
|
|
@ -1210,10 +1210,11 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
|
||||||
cmGlobalGenerator* gg = new cmGlobalGenerator();
|
cmGlobalGenerator* gg = new cmGlobalGenerator();
|
||||||
gg->SetCMakeInstance(cm);
|
gg->SetCMakeInstance(cm);
|
||||||
|
|
||||||
|
cm->SetHomeOutputDirectory(targetDirectory);
|
||||||
|
cm->SetHomeDirectory(targetDirectory);
|
||||||
|
|
||||||
cmLocalGenerator* lg = gg->CreateLocalGenerator();
|
cmLocalGenerator* lg = gg->CreateLocalGenerator();
|
||||||
lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory);
|
|
||||||
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
|
lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory);
|
||||||
lg->GetMakefile()->SetHomeDirectory(targetDirectory);
|
|
||||||
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
|
lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory);
|
||||||
gg->SetCurrentLocalGenerator(lg);
|
gg->SetCurrentLocalGenerator(lg);
|
||||||
|
|
||||||
|
@ -1225,6 +1226,8 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
cmake cm;
|
cmake cm;
|
||||||
|
cm.SetHomeOutputDirectory(targetDirectory);
|
||||||
|
cm.SetHomeDirectory(targetDirectory);
|
||||||
cmGlobalGenerator* gg = CreateGlobalGenerator(&cm, targetDirectory);
|
cmGlobalGenerator* gg = CreateGlobalGenerator(&cm, targetDirectory);
|
||||||
cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
|
cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
|
||||||
|
|
||||||
|
|
|
@ -372,13 +372,13 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
|
||||||
// read in the list file to fill the cache
|
// read in the list file to fill the cache
|
||||||
if(path)
|
if(path)
|
||||||
{
|
{
|
||||||
|
std::string homeDir = this->GetHomeDirectory();
|
||||||
|
std::string homeOutputDir = this->GetHomeOutputDirectory();
|
||||||
|
this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory());
|
||||||
|
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
|
||||||
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
|
cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
|
||||||
lg->GetMakefile()->SetHomeOutputDirectory
|
|
||||||
(cmSystemTools::GetCurrentWorkingDirectory());
|
|
||||||
lg->GetMakefile()->SetCurrentBinaryDirectory
|
lg->GetMakefile()->SetCurrentBinaryDirectory
|
||||||
(cmSystemTools::GetCurrentWorkingDirectory());
|
(cmSystemTools::GetCurrentWorkingDirectory());
|
||||||
lg->GetMakefile()->SetHomeDirectory
|
|
||||||
(cmSystemTools::GetCurrentWorkingDirectory());
|
|
||||||
lg->GetMakefile()->SetCurrentSourceDirectory
|
lg->GetMakefile()->SetCurrentSourceDirectory
|
||||||
(cmSystemTools::GetCurrentWorkingDirectory());
|
(cmSystemTools::GetCurrentWorkingDirectory());
|
||||||
if (this->GetWorkingMode() != NORMAL_MODE)
|
if (this->GetWorkingMode() != NORMAL_MODE)
|
||||||
|
@ -393,6 +393,8 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
|
||||||
{
|
{
|
||||||
cmSystemTools::Error("Error processing file: ", path);
|
cmSystemTools::Error("Error processing file: ", path);
|
||||||
}
|
}
|
||||||
|
this->SetHomeDirectory(homeDir);
|
||||||
|
this->SetHomeOutputDirectory(homeOutputDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// free generic one if generated
|
// free generic one if generated
|
||||||
|
|
Loading…
Reference in New Issue