|
@@ -179,11 +179,11 @@ void cmMakefile::Print() const
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
std::cout << " this->StartOutputDirectory; " <<
|
|
std::cout << " this->StartOutputDirectory; " <<
|
|
|
- this->StartOutputDirectory << std::endl;
|
|
|
|
|
|
|
+ this->GetCurrentBinaryDirectory() << std::endl;
|
|
|
std::cout << " this->HomeOutputDirectory; " <<
|
|
std::cout << " this->HomeOutputDirectory; " <<
|
|
|
this->HomeOutputDirectory << std::endl;
|
|
this->HomeOutputDirectory << std::endl;
|
|
|
std::cout << " this->cmStartDirectory; " <<
|
|
std::cout << " this->cmStartDirectory; " <<
|
|
|
- this->cmStartDirectory << std::endl;
|
|
|
|
|
|
|
+ this->GetCurrentSourceDirectory() << std::endl;
|
|
|
std::cout << " this->cmHomeDirectory; " <<
|
|
std::cout << " this->cmHomeDirectory; " <<
|
|
|
this->cmHomeDirectory << std::endl;
|
|
this->cmHomeDirectory << std::endl;
|
|
|
std::cout << " this->ProjectName; "
|
|
std::cout << " this->ProjectName; "
|
|
@@ -223,7 +223,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
|
|
|
if(this->ListFileStack.empty())
|
|
if(this->ListFileStack.empty())
|
|
|
{
|
|
{
|
|
|
// We are not processing the project. Add the directory-level context.
|
|
// We are not processing the project. Add the directory-level context.
|
|
|
- lfc.FilePath = this->GetCurrentDirectory();
|
|
|
|
|
|
|
+ lfc.FilePath = this->GetCurrentSourceDirectory();
|
|
|
lfc.FilePath += "/CMakeLists.txt";
|
|
lfc.FilePath += "/CMakeLists.txt";
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -480,8 +480,9 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile)
|
|
|
{
|
|
{
|
|
|
this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile);
|
|
this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile);
|
|
|
this->cmCurrentListFile = listfile;
|
|
this->cmCurrentListFile = listfile;
|
|
|
|
|
+ std::string curSrc = this->GetCurrentSourceDirectory();
|
|
|
return this->ReadListFile(listfile, true,
|
|
return this->ReadListFile(listfile, true,
|
|
|
- this->cmStartDirectory == this->cmHomeDirectory);
|
|
|
|
|
|
|
+ curSrc == this->GetHomeDirectory());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
|
|
bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
|
|
@@ -489,7 +490,7 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope)
|
|
|
this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile());
|
|
this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile());
|
|
|
this->cmCurrentListFile =
|
|
this->cmCurrentListFile =
|
|
|
cmSystemTools::CollapseFullPath(listfile,
|
|
cmSystemTools::CollapseFullPath(listfile,
|
|
|
- this->cmStartDirectory.c_str());
|
|
|
|
|
|
|
+ this->GetCurrentSourceDirectory());
|
|
|
return this->ReadListFile(this->cmCurrentListFile.c_str(),
|
|
return this->ReadListFile(this->cmCurrentListFile.c_str(),
|
|
|
noPolicyScope);
|
|
noPolicyScope);
|
|
|
}
|
|
}
|
|
@@ -503,7 +504,7 @@ bool cmMakefile::ReadListFile(const char* listfile,
|
|
|
{
|
|
{
|
|
|
std::string filenametoread =
|
|
std::string filenametoread =
|
|
|
cmSystemTools::CollapseFullPath(listfile,
|
|
cmSystemTools::CollapseFullPath(listfile,
|
|
|
- this->cmStartDirectory.c_str());
|
|
|
|
|
|
|
+ this->GetCurrentSourceDirectory());
|
|
|
|
|
|
|
|
std::string currentParentFile
|
|
std::string currentParentFile
|
|
|
= this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
|
|
= this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
|
|
@@ -650,6 +651,9 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
|
|
|
this->Properties.SetCMakeInstance(this->GetCMakeInstance());
|
|
this->Properties.SetCMakeInstance(this->GetCMakeInstance());
|
|
|
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
|
|
this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
|
|
|
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
|
|
this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
|
|
|
|
|
+ this->SetHomeDirectory(this->GetCMakeInstance()->GetHomeDirectory());
|
|
|
|
|
+ this->SetHomeOutputDirectory(
|
|
|
|
|
+ this->GetCMakeInstance()->GetHomeOutputDirectory());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
namespace
|
|
namespace
|
|
@@ -1187,7 +1191,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName,
|
|
|
// Store the custom command in the target.
|
|
// Store the custom command in the target.
|
|
|
if (!commandLines.empty() || !depends.empty())
|
|
if (!commandLines.empty() || !depends.empty())
|
|
|
{
|
|
{
|
|
|
- std::string force = this->GetStartOutputDirectory();
|
|
|
|
|
|
|
+ std::string force = this->GetCurrentBinaryDirectory();
|
|
|
force += cmake::GetCMakeFilesDirectory();
|
|
force += cmake::GetCMakeFilesDirectory();
|
|
|
force += "/";
|
|
force += "/";
|
|
|
force += utilityName;
|
|
force += utilityName;
|
|
@@ -1497,6 +1501,11 @@ void cmMakefile::InitializeFromParent()
|
|
|
// Initialize definitions with the closure of the parent scope.
|
|
// Initialize definitions with the closure of the parent scope.
|
|
|
this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure();
|
|
this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure();
|
|
|
|
|
|
|
|
|
|
+ this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
|
|
|
|
|
+ this->GetCurrentSourceDirectory());
|
|
|
|
|
+ this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
|
|
|
|
|
+ this->GetCurrentBinaryDirectory());
|
|
|
|
|
+
|
|
|
const std::vector<cmValueWithOrigin>& parentIncludes =
|
|
const std::vector<cmValueWithOrigin>& parentIncludes =
|
|
|
parent->GetIncludeDirectoriesEntries();
|
|
parent->GetIncludeDirectoriesEntries();
|
|
|
this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(),
|
|
this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(),
|
|
@@ -1565,11 +1574,10 @@ void cmMakefile::InitializeFromParent()
|
|
|
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
|
|
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
|
|
|
{
|
|
{
|
|
|
lg2->GetMakefile()->InitializeFromParent();
|
|
lg2->GetMakefile()->InitializeFromParent();
|
|
|
- lg2->GetMakefile()->MakeStartDirectoriesCurrent();
|
|
|
|
|
if (this->GetCMakeInstance()->GetDebugOutput())
|
|
if (this->GetCMakeInstance()->GetDebugOutput())
|
|
|
{
|
|
{
|
|
|
std::string msg=" Entering ";
|
|
std::string msg=" Entering ";
|
|
|
- msg += lg2->GetMakefile()->GetCurrentDirectory();
|
|
|
|
|
|
|
+ msg += lg2->GetMakefile()->GetCurrentSourceDirectory();
|
|
|
cmSystemTools::Message(msg.c_str());
|
|
cmSystemTools::Message(msg.c_str());
|
|
|
}
|
|
}
|
|
|
// finally configure the subdir
|
|
// finally configure the subdir
|
|
@@ -1577,7 +1585,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
|
|
|
if (this->GetCMakeInstance()->GetDebugOutput())
|
|
if (this->GetCMakeInstance()->GetDebugOutput())
|
|
|
{
|
|
{
|
|
|
std::string msg=" Returning to ";
|
|
std::string msg=" Returning to ";
|
|
|
- msg += this->GetCurrentDirectory();
|
|
|
|
|
|
|
+ msg += this->GetCurrentSourceDirectory();
|
|
|
cmSystemTools::Message(msg.c_str());
|
|
cmSystemTools::Message(msg.c_str());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1600,8 +1608,8 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
|
|
|
this->LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2);
|
|
this->LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2);
|
|
|
|
|
|
|
|
// set the subdirs start dirs
|
|
// set the subdirs start dirs
|
|
|
- lg2->GetMakefile()->SetStartDirectory(srcPath);
|
|
|
|
|
- lg2->GetMakefile()->SetStartOutputDirectory(binPath);
|
|
|
|
|
|
|
+ lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath);
|
|
|
|
|
+ lg2->GetMakefile()->SetCurrentBinaryDirectory(binPath);
|
|
|
if(excludeFromAll)
|
|
if(excludeFromAll)
|
|
|
{
|
|
{
|
|
|
lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
|
|
lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
|
|
@@ -1613,6 +1621,37 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+void cmMakefile::SetCurrentSourceDirectory(const std::string& dir)
|
|
|
|
|
+{
|
|
|
|
|
+ this->cmStartDirectory = dir;
|
|
|
|
|
+ cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
|
|
|
|
|
+ this->cmStartDirectory =
|
|
|
|
|
+ cmSystemTools::CollapseFullPath(this->cmStartDirectory);
|
|
|
|
|
+ this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR",
|
|
|
|
|
+ this->cmStartDirectory.c_str());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const char* cmMakefile::GetCurrentSourceDirectory() const
|
|
|
|
|
+{
|
|
|
|
|
+ return this->cmStartDirectory.c_str();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void cmMakefile::SetCurrentBinaryDirectory(const std::string& dir)
|
|
|
|
|
+{
|
|
|
|
|
+ this->StartOutputDirectory = dir;
|
|
|
|
|
+ cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory);
|
|
|
|
|
+ this->StartOutputDirectory =
|
|
|
|
|
+ cmSystemTools::CollapseFullPath(this->StartOutputDirectory);
|
|
|
|
|
+ cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str());
|
|
|
|
|
+ this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
|
|
|
|
|
+ this->StartOutputDirectory.c_str());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const char* cmMakefile::GetCurrentBinaryDirectory() const
|
|
|
|
|
+{
|
|
|
|
|
+ return this->StartOutputDirectory.c_str();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
//----------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------
|
|
|
void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
|
|
void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
|
|
|
bool before)
|
|
bool before)
|
|
@@ -1809,7 +1848,7 @@ void cmMakefile::CheckForUnused(const char* reason,
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- path = this->GetStartDirectory();
|
|
|
|
|
|
|
+ path = this->GetCurrentSourceDirectory();
|
|
|
path += "/CMakeLists.txt";
|
|
path += "/CMakeLists.txt";
|
|
|
cmListFileContext lfc;
|
|
cmListFileContext lfc;
|
|
|
lfc.FilePath = path;
|
|
lfc.FilePath = path;
|
|
@@ -3362,9 +3401,9 @@ const char* cmMakefile::GetHomeOutputDirectory() const
|
|
|
return this->HomeOutputDirectory.c_str();
|
|
return this->HomeOutputDirectory.c_str();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void cmMakefile::SetHomeOutputDirectory(const std::string& lib)
|
|
|
|
|
|
|
+void cmMakefile::SetHomeOutputDirectory(const std::string& dir)
|
|
|
{
|
|
{
|
|
|
- this->HomeOutputDirectory = lib;
|
|
|
|
|
|
|
+ this->HomeOutputDirectory = dir;
|
|
|
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
|
|
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
|
|
|
this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory());
|
|
this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory());
|
|
|
if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
|
|
if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") )
|
|
@@ -3491,8 +3530,6 @@ int cmMakefile::TryCompile(const std::string& srcdir,
|
|
|
// do a configure
|
|
// do a configure
|
|
|
cm.SetHomeDirectory(srcdir);
|
|
cm.SetHomeDirectory(srcdir);
|
|
|
cm.SetHomeOutputDirectory(bindir);
|
|
cm.SetHomeOutputDirectory(bindir);
|
|
|
- cm.SetStartDirectory(srcdir);
|
|
|
|
|
- cm.SetStartOutputDirectory(bindir);
|
|
|
|
|
cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform());
|
|
cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform());
|
|
|
cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset());
|
|
cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset());
|
|
|
cm.LoadCache();
|
|
cm.LoadCache();
|
|
@@ -3988,8 +4025,8 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
|
|
|
if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
|
|
if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
|
|
|
{
|
|
{
|
|
|
// This property is not inherrited
|
|
// This property is not inherrited
|
|
|
- if ( strcmp(this->GetCurrentDirectory(),
|
|
|
|
|
- this->GetStartDirectory()) != 0 )
|
|
|
|
|
|
|
+ if ( strcmp(this->GetCurrentSourceDirectory(),
|
|
|
|
|
+ this->GetCurrentSourceDirectory()) != 0 )
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -4053,7 +4090,7 @@ const char *cmMakefile::GetProperty(const std::string& prop,
|
|
|
{
|
|
{
|
|
|
if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
|
|
if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
|
|
|
{
|
|
{
|
|
|
- output = plg->GetMakefile()->GetStartDirectory();
|
|
|
|
|
|
|
+ output = plg->GetMakefile()->GetCurrentSourceDirectory();
|
|
|
}
|
|
}
|
|
|
return output.c_str();
|
|
return output.c_str();
|
|
|
}
|
|
}
|
|
@@ -4256,7 +4293,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- std::string f = this->GetCurrentDirectory();
|
|
|
|
|
|
|
+ std::string f = this->GetCurrentSourceDirectory();
|
|
|
f += "/";
|
|
f += "/";
|
|
|
f += *i;
|
|
f += *i;
|
|
|
this->AddCMakeDependFile(f);
|
|
this->AddCMakeDependFile(f);
|
|
@@ -4537,7 +4574,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
|
|
|
default: break;
|
|
default: break;
|
|
|
}
|
|
}
|
|
|
e << "created in source directory \""
|
|
e << "created in source directory \""
|
|
|
- << existing->GetMakefile()->GetCurrentDirectory() << "\". "
|
|
|
|
|
|
|
+ << existing->GetMakefile()->GetCurrentSourceDirectory() << "\". "
|
|
|
<< "See documentation for policy CMP0002 for more details.";
|
|
<< "See documentation for policy CMP0002 for more details.";
|
|
|
msg = e.str();
|
|
msg = e.str();
|
|
|
return false;
|
|
return false;
|