cmMakefile: Rename GetCurrent{,Source}Directory.

Match the names used in cmake code.
This commit is contained in:
Stephen Kelly 2015-04-16 21:17:41 +02:00
parent b23cf06f86
commit 55d80d0a85
31 changed files with 65 additions and 61 deletions

View File

@ -346,7 +346,7 @@ void cmCTestScriptHandler::CreateCMake()
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
// Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR.
// Also, some commands need Makefile->GetCurrentDirectory().
// Also, some commands need Makefile->GetCurrentSourceDirectory().
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
this->Makefile->SetStartDirectory(cwd);
this->Makefile->SetStartOutputDirectory(cwd);

View File

@ -57,7 +57,7 @@ bool cmAddSubDirectoryCommand::InitialPass
}
else
{
srcPath = this->Makefile->GetCurrentDirectory();
srcPath = this->Makefile->GetCurrentSourceDirectory();
srcPath += "/";
srcPath += srcArg;
}
@ -79,12 +79,12 @@ bool cmAddSubDirectoryCommand::InitialPass
// not a subdirectory of the current directory then it is an
// error.
if(!cmSystemTools::IsSubDirectory(srcPath,
this->Makefile->GetCurrentDirectory()))
this->Makefile->GetCurrentSourceDirectory()))
{
std::ostringstream e;
e << "not given a binary directory but the given source directory "
<< "\"" << srcPath << "\" is not a subdirectory of \""
<< this->Makefile->GetCurrentDirectory() << "\". "
<< this->Makefile->GetCurrentSourceDirectory() << "\". "
<< "When specifying an out-of-tree source a binary directory "
<< "must be explicitly specified.";
this->SetError(e.str());
@ -93,7 +93,7 @@ bool cmAddSubDirectoryCommand::InitialPass
// Remove the CurrentDirectory from the srcPath and replace it
// with the CurrentOutputDirectory.
const char* src = this->Makefile->GetCurrentDirectory();
const char* src = this->Makefile->GetCurrentSourceDirectory();
const char* bin = this->Makefile->GetCurrentOutputDirectory();
size_t srcLen = strlen(src);
size_t binLen = strlen(bin);

View File

@ -29,7 +29,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass
std::string tdir;
if(!cmSystemTools::FileIsFullPath(templateDirectory.c_str()))
{
tdir = this->Makefile->GetCurrentDirectory();
tdir = this->Makefile->GetCurrentSourceDirectory();
tdir += "/";
tdir += templateDirectory;
}

View File

@ -141,7 +141,7 @@ const char* CCONV cmGetStartOutputDirectory(void *arg)
const char* CCONV cmGetCurrentDirectory(void *arg)
{
cmMakefile *mf = static_cast<cmMakefile *>(arg);
return mf->GetCurrentDirectory();
return mf->GetCurrentSourceDirectory();
}
const char* CCONV cmGetCurrentOutputDirectory(void *arg)
{

View File

@ -26,7 +26,7 @@ bool cmConfigureFileCommand
const char* inFile = args[0].c_str();
if(!cmSystemTools::FileIsFullPath(inFile))
{
this->InputFile = this->Makefile->GetCurrentDirectory();
this->InputFile = this->Makefile->GetCurrentSourceDirectory();
this->InputFile += "/";
}
this->InputFile += inFile;

View File

@ -81,7 +81,7 @@ void cmExtraQbsGenerator::AppendSubProject(cmGeneratedFileStream &fout,
}
const std::string &relativePath = cmSystemTools::RelativePath(
mk->GetHomeDirectory(), mk->GetCurrentDirectory());
mk->GetHomeDirectory(), mk->GetCurrentSourceDirectory());
fout << "\tProject {\n"
<< "\t\tname:\"" << relativePath << "\"\n";
this->AppendProduct(fout, lg);

View File

@ -24,7 +24,7 @@ bool cmFLTKWrapUICommand
}
// what is the current source dir
std::string cdir = this->Makefile->GetCurrentDirectory();
std::string cdir = this->Makefile->GetCurrentSourceDirectory();
const char* fluid_exe =
this->Makefile->GetRequiredDefinition("FLTK_FLUID_EXECUTABLE");

View File

@ -227,7 +227,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
std::string fileName = *i;
if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) )
{
fileName = this->Makefile->GetCurrentDirectory();
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + *i;
}
@ -309,7 +309,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args)
std::string fileName = fileNameArg.GetString();
if ( !cmsys::SystemTools::FileIsFullPath(fileName.c_str()) )
{
fileName = this->Makefile->GetCurrentDirectory();
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + fileNameArg.GetString();
}
@ -445,7 +445,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args)
std::string fileName = args[1];
if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str()))
{
fileName = this->Makefile->GetCurrentDirectory();
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + args[1];
}
@ -984,7 +984,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
cmsys::Glob::GlobMessages globMessages;
if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) )
{
std::string expr = this->Makefile->GetCurrentDirectory();
std::string expr = this->Makefile->GetCurrentSourceDirectory();
// Handle script mode
if (!expr.empty())
{
@ -1091,7 +1091,7 @@ bool cmFileCommand::HandleMakeDirectoryCommand(
const std::string* cdir = &(*i);
if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) )
{
expr = this->Makefile->GetCurrentDirectory();
expr = this->Makefile->GetCurrentSourceDirectory();
expr += "/" + *i;
cdir = &expr;
}
@ -1556,7 +1556,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
}
else
{
std::string file = this->Makefile->GetCurrentDirectory();
std::string file = this->Makefile->GetCurrentSourceDirectory();
file += "/" + arg;
this->Files.push_back(file);
}
@ -2658,13 +2658,13 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args)
std::string oldname = args[1];
if(!cmsys::SystemTools::FileIsFullPath(oldname.c_str()))
{
oldname = this->Makefile->GetCurrentDirectory();
oldname = this->Makefile->GetCurrentSourceDirectory();
oldname += "/" + args[1];
}
std::string newname = args[2];
if(!cmsys::SystemTools::FileIsFullPath(newname.c_str()))
{
newname = this->Makefile->GetCurrentDirectory();
newname = this->Makefile->GetCurrentSourceDirectory();
newname += "/" + args[2];
}
@ -2698,7 +2698,7 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args,
std::string fileName = *i;
if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str()))
{
fileName = this->Makefile->GetCurrentDirectory();
fileName = this->Makefile->GetCurrentSourceDirectory();
fileName += "/" + *i;
}
@ -3743,7 +3743,7 @@ bool cmFileCommand::HandleLockCommand(
if (!cmsys::SystemTools::FileIsFullPath(path))
{
path = this->Makefile->GetCurrentDirectory() + ("/" + path);
path = this->Makefile->GetCurrentSourceDirectory() + ("/" + path);
}
// Unify path (remove '//', '/../', ...)

View File

@ -663,7 +663,7 @@ bool cmFindPackageCommand::HandlePackageMode()
if(!cmSystemTools::FileIsFullPath(dir.c_str()))
{
dir = "/" + dir;
dir = this->Makefile->GetCurrentDirectory() + dir;
dir = this->Makefile->GetCurrentSourceDirectory() + dir;
}
// The file location was cached. Look for the correct file.
std::string file;

View File

@ -97,7 +97,7 @@ bool cmGetFilenameComponentCommand
// If the path given is relative evaluate it relative to the
// current source directory.
result = cmSystemTools::CollapseFullPath(
filename, this->Makefile->GetCurrentDirectory());
filename, this->Makefile->GetCurrentSourceDirectory());
if(args[2] == "REALPATH")
{
// Resolve symlinks if possible

View File

@ -255,7 +255,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode()
std::string dir = this->Name;
if(!cmSystemTools::FileIsFullPath(dir.c_str()))
{
dir = this->Makefile->GetCurrentDirectory();
dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/";
dir += this->Name;
}

View File

@ -1567,7 +1567,8 @@ void cmGlobalGenerator::CheckLocalGenerators()
text += "\n linked by target \"";
text += l->second.GetName();
text += "\" in directory ";
text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory();
text+=this->LocalGenerators[i]->GetMakefile()
->GetCurrentSourceDirectory();
notFoundMap[varName] = text;
}
}
@ -1597,7 +1598,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
std::string text = notFoundMap[varName];
text += "\n used as include directory in directory ";
text += this->LocalGenerators[i]
->GetMakefile()->GetCurrentDirectory();
->GetMakefile()->GetCurrentSourceDirectory();
notFoundMap[varName] = text;
}
}

View File

@ -407,7 +407,7 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
{
this->CurrentProject = root->GetMakefile()->GetProjectName();
this->SetCurrentLocalGenerator(root);
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentDirectory(),
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(),
this->ProjectSourceDirectoryComponents);
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentOutputDirectory(),
this->ProjectOutputDirectoryComponents);
@ -3342,7 +3342,7 @@ bool cmGlobalXCodeGenerator
// Point Xcode at the top of the source tree.
{
std::string pdir =
this->RelativeToBinary(root->GetMakefile()->GetCurrentDirectory());
this->RelativeToBinary(root->GetMakefile()->GetCurrentSourceDirectory());
this->RootObject->AddAttribute("projectDirPath",
this->CreateString(pdir.c_str()));
this->RootObject->AddAttribute("projectRoot", this->CreateString(""));

View File

@ -163,7 +163,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args)
std::string script = args[i];
if(!cmSystemTools::FileIsFullPath(script.c_str()))
{
script = this->Makefile->GetCurrentDirectory();
script = this->Makefile->GetCurrentSourceDirectory();
script += "/";
script += args[i];
}
@ -1093,7 +1093,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args)
std::string dir = args[i];
if(!cmSystemTools::FileIsFullPath(dir.c_str()))
{
dir = this->Makefile->GetCurrentDirectory();
dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/";
dir += args[i];
}
@ -1376,7 +1376,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName,
std::string::size_type gpos = cmGeneratorExpression::Find(file);
if(gpos != 0 && !cmSystemTools::FileIsFullPath(file.c_str()))
{
file = this->Makefile->GetCurrentDirectory();
file = this->Makefile->GetCurrentSourceDirectory();
file += "/";
file += *fileIt;
}

View File

@ -95,7 +95,7 @@ void cmInstallFilesCommand::FinalPass()
{
std::vector<std::string> files;
std::string regex = this->FinalArgs[0];
cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(),
cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(),
regex, files);
std::vector<std::string>::iterator s = files.begin();
@ -155,7 +155,7 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const
std::string tb = this->Makefile->GetCurrentOutputDirectory();
tb += "/";
tb += name;
std::string ts = this->Makefile->GetCurrentDirectory();
std::string ts = this->Makefile->GetCurrentSourceDirectory();
ts += "/";
ts += name;

View File

@ -63,7 +63,7 @@ void cmInstallProgramsCommand::FinalPass()
else // reg exp list
{
std::vector<std::string> programs;
cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(),
cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(),
this->FinalArgs[0], programs);
std::vector<std::string>::iterator s = programs.begin();
@ -118,7 +118,7 @@ std::string cmInstallProgramsCommand
std::string tb = this->Makefile->GetCurrentOutputDirectory();
tb += "/";
tb += name;
std::string ts = this->Makefile->GetCurrentDirectory();
std::string ts = this->Makefile->GetCurrentSourceDirectory();
ts += "/";
ts += name;

View File

@ -438,7 +438,8 @@ void cmLocalGenerator::GenerateInstallRules()
// Write the header.
fout << "# Install script for directory: "
<< this->Makefile->GetCurrentDirectory() << std::endl << std::endl;
<< this->Makefile->GetCurrentSourceDirectory()
<< std::endl << std::endl;
fout << "# Set the install prefix" << std::endl
<< "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl
<< " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl
@ -2159,7 +2160,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
// Treat the name as relative to the source directory in which it
// was given.
dep = this->Makefile->GetCurrentDirectory();
dep = this->Makefile->GetCurrentSourceDirectory();
dep += "/";
dep += inName;
return true;

View File

@ -269,7 +269,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
if(this->ListFileStack.empty())
{
// We are not processing the project. Add the directory-level context.
lfc.FilePath = this->GetCurrentDirectory();
lfc.FilePath = this->GetCurrentSourceDirectory();
lfc.FilePath += "/CMakeLists.txt";
}
else
@ -1622,7 +1622,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
if (this->GetCMakeInstance()->GetDebugOutput())
{
std::string msg=" Entering ";
msg += lg2->GetMakefile()->GetCurrentDirectory();
msg += lg2->GetMakefile()->GetCurrentSourceDirectory();
cmSystemTools::Message(msg.c_str());
}
// finally configure the subdir
@ -1630,7 +1630,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
if (this->GetCMakeInstance()->GetDebugOutput())
{
std::string msg=" Returning to ";
msg += this->GetCurrentDirectory();
msg += this->GetCurrentSourceDirectory();
cmSystemTools::Message(msg.c_str());
}
}
@ -4039,7 +4039,7 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" )
{
// This property is not inherrited
if ( strcmp(this->GetCurrentDirectory(),
if ( strcmp(this->GetCurrentSourceDirectory(),
this->GetStartDirectory()) != 0 )
{
return;
@ -4307,7 +4307,7 @@ void cmMakefile::AddCMakeDependFilesFromUser()
}
else
{
std::string f = this->GetCurrentDirectory();
std::string f = this->GetCurrentSourceDirectory();
f += "/";
f += *i;
this->AddCMakeDependFile(f);
@ -4588,7 +4588,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
default: break;
}
e << "created in source directory \""
<< existing->GetMakefile()->GetCurrentDirectory() << "\". "
<< existing->GetMakefile()->GetCurrentSourceDirectory() << "\". "
<< "See documentation for policy CMP0002 for more details.";
msg = e.str();
return false;

View File

@ -484,7 +484,7 @@ public:
}
//@}
const char* GetCurrentDirectory() const
const char* GetCurrentSourceDirectory() const
{
return this->cmStartDirectory.c_str();
}

View File

@ -33,7 +33,7 @@ bool cmProjectCommand
"Value Computed by CMake", cmState::STATIC);
this->Makefile->AddCacheDefinition
(srcdir,
this->Makefile->GetCurrentDirectory(),
this->Makefile->GetCurrentSourceDirectory(),
"Value Computed by CMake", cmState::STATIC);
bindir = "PROJECT_BINARY_DIR";
@ -42,7 +42,7 @@ bool cmProjectCommand
this->Makefile->AddDefinition(bindir,
this->Makefile->GetCurrentOutputDirectory());
this->Makefile->AddDefinition(srcdir,
this->Makefile->GetCurrentDirectory());
this->Makefile->GetCurrentSourceDirectory());
this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str());

View File

@ -66,7 +66,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args,
}
else
{
hname = this->Makefile->GetCurrentDirectory();
hname = this->Makefile->GetCurrentSourceDirectory();
}
hname += "/";
hname += *j;

View File

@ -73,7 +73,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args,
}
else
{
uiName = this->Makefile->GetCurrentDirectory();
uiName = this->Makefile->GetCurrentSourceDirectory();
}
uiName += "/";
uiName += *j;

View File

@ -86,7 +86,7 @@ void cmSearchPath::AddUserPath(const std::string& path)
for(std::vector<std::string>::const_iterator p = outPaths.begin();
p != outPaths.end(); ++p)
{
this->AddPathInternal(*p, this->FC->Makefile->GetCurrentDirectory());
this->AddPathInternal(*p, this->FC->Makefile->GetCurrentSourceDirectory());
}
}
@ -104,7 +104,8 @@ void cmSearchPath::AddCMakePath(const std::string& variable)
for(std::vector<std::string>::const_iterator p = expanded.begin();
p!= expanded.end(); ++p)
{
this->AddPathInternal(*p, this->FC->Makefile->GetCurrentDirectory());
this->AddPathInternal(*p,
this->FC->Makefile->GetCurrentSourceDirectory());
}
}
}
@ -132,7 +133,8 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable)
std::vector<std::string> expanded;
cmSystemTools::ExpandListArgument(value, expanded);
this->AddPrefixPaths(expanded, this->FC->Makefile->GetCurrentDirectory());
this->AddPrefixPaths(expanded,
this->FC->Makefile->GetCurrentSourceDirectory());
}
}

View File

@ -197,7 +197,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
std::string dir = *this->Names.begin();
if(!cmSystemTools::FileIsFullPath(dir.c_str()))
{
dir = this->Makefile->GetCurrentDirectory();
dir = this->Makefile->GetCurrentSourceDirectory();
dir += "/";
dir += *this->Names.begin();
}

View File

@ -162,7 +162,7 @@ bool cmSourceFile::FindFullPath(std::string* error)
const char* tryDirs[3] = {0, 0, 0};
if(this->Location.DirectoryIsAmbiguous())
{
tryDirs[0] = mf->GetCurrentDirectory();
tryDirs[0] = mf->GetCurrentSourceDirectory();
tryDirs[1] = mf->GetCurrentOutputDirectory();
}
else

View File

@ -93,7 +93,7 @@ void cmSourceFileLocation::DirectoryUseSource()
{
this->Directory =
cmSystemTools::CollapseFullPath(
this->Directory, this->Makefile->GetCurrentDirectory());
this->Directory, this->Makefile->GetCurrentSourceDirectory());
this->AmbiguousDirectory = false;
}
}
@ -143,7 +143,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name)
// Check the source tree only because a file in the build tree should
// be specified by full path at least once. We do not want this
// detection to depend on whether the project has already been built.
tryPath = this->Makefile->GetCurrentDirectory();
tryPath = this->Makefile->GetCurrentSourceDirectory();
tryPath += "/";
}
if(!this->Directory.empty())
@ -282,7 +282,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
// Compare possible directory combinations.
std::string const& srcDir =
cmSystemTools::CollapseFullPath(
this->Directory, this->Makefile->GetCurrentDirectory());
this->Directory, this->Makefile->GetCurrentSourceDirectory());
std::string const& binDir =
cmSystemTools::CollapseFullPath(
this->Directory, this->Makefile->GetCurrentOutputDirectory());
@ -297,7 +297,7 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
// Compare possible directory combinations.
std::string const& srcDir =
cmSystemTools::CollapseFullPath(
loc.Directory, loc.Makefile->GetCurrentDirectory());
loc.Directory, loc.Makefile->GetCurrentSourceDirectory());
std::string const& binDir =
cmSystemTools::CollapseFullPath(
loc.Directory, loc.Makefile->GetCurrentOutputDirectory());

View File

@ -81,7 +81,7 @@ bool cmSourceGroupCommand
std::string src = args[i];
if(!cmSystemTools::FileIsFullPath(src.c_str()))
{
src = this->Makefile->GetCurrentDirectory();
src = this->Makefile->GetCurrentSourceDirectory();
src += "/";
src += args[i];
}

View File

@ -39,7 +39,7 @@ bool cmSubdirCommand
// if they specified a relative path then compute the full
std::string srcPath =
std::string(this->Makefile->GetCurrentDirectory()) +
std::string(this->Makefile->GetCurrentSourceDirectory()) +
"/" + i->c_str();
if (cmSystemTools::FileIsDirectory(srcPath))
{

View File

@ -75,7 +75,7 @@ bool cmUtilitySourceCommand
// The third argument specifies the relative directory of the source
// of the utility.
std::string relativeSource = *arg++;
std::string utilitySource = this->Makefile->GetCurrentDirectory();
std::string utilitySource = this->Makefile->GetCurrentSourceDirectory();
utilitySource = utilitySource+"/"+relativeSource;
// If the directory doesn't exist, the source has not been included.

View File

@ -2194,7 +2194,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
{
// Look through the sources for AndroidManifest.xml and use
// its location as the root source directory.
std::string rootDir = this->Makefile->GetCurrentDirectory();
std::string rootDir = this->Makefile->GetCurrentSourceDirectory();
{
std::vector<cmSourceFile const*> extraSources;
this->GeneratorTarget->GetExtraSources(extraSources, "");

View File

@ -154,7 +154,7 @@ static void cmakemainProgressCallback(const char *m, float prog,
if ((mf) && (strstr(m, "Configuring")==m) && (prog<0))
{
dir = " ";
dir += mf->GetCurrentDirectory();
dir += mf->GetCurrentSourceDirectory();
}
else if ((mf) && (strstr(m, "Generating")==m))
{