cmLocalGenerator: Add current source directory accessor.
This commit is contained in:
parent
bbef3c2da8
commit
a367416cec
|
@ -497,7 +497,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
|
||||||
|
|
||||||
std::string sourceLinkedResourceName = "[Source directory]";
|
std::string sourceLinkedResourceName = "[Source directory]";
|
||||||
std::string linkSourceDirectory = this->GetEclipsePath(
|
std::string linkSourceDirectory = this->GetEclipsePath(
|
||||||
mf->GetCurrentSourceDirectory());
|
lg->GetCurrentSourceDirectory());
|
||||||
// .project dir can't be subdir of a linked resource dir
|
// .project dir can't be subdir of a linked resource dir
|
||||||
if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory,
|
if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory,
|
||||||
linkSourceDirectory))
|
linkSourceDirectory))
|
||||||
|
@ -638,7 +638,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects(
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
std::string linkSourceDirectory = this->GetEclipsePath(
|
std::string linkSourceDirectory = this->GetEclipsePath(
|
||||||
it->second[0]->GetMakefile()->GetCurrentSourceDirectory());
|
it->second[0]->GetCurrentSourceDirectory());
|
||||||
// a linked resource must not point to a parent directory of .project or
|
// a linked resource must not point to a parent directory of .project or
|
||||||
// .project itself
|
// .project itself
|
||||||
if ((baseDir != linkSourceDirectory) &&
|
if ((baseDir != linkSourceDirectory) &&
|
||||||
|
|
|
@ -2105,7 +2105,7 @@ cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const
|
||||||
for(std::vector<cmLocalGenerator*>::const_iterator it =
|
for(std::vector<cmLocalGenerator*>::const_iterator it =
|
||||||
this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it)
|
this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it)
|
||||||
{
|
{
|
||||||
std::string sd = (*it)->GetMakefile()->GetCurrentSourceDirectory();
|
std::string sd = (*it)->GetCurrentSourceDirectory();
|
||||||
if (sd == start_dir)
|
if (sd == start_dir)
|
||||||
{
|
{
|
||||||
return *it;
|
return *it;
|
||||||
|
|
|
@ -412,8 +412,9 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
|
||||||
{
|
{
|
||||||
this->CurrentProject = root->GetProjectName();
|
this->CurrentProject = root->GetProjectName();
|
||||||
this->SetCurrentLocalGenerator(root);
|
this->SetCurrentLocalGenerator(root);
|
||||||
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(),
|
cmSystemTools::SplitPath(
|
||||||
this->ProjectSourceDirectoryComponents);
|
this->CurrentLocalGenerator->GetCurrentSourceDirectory(),
|
||||||
|
this->ProjectSourceDirectoryComponents);
|
||||||
cmSystemTools::SplitPath(
|
cmSystemTools::SplitPath(
|
||||||
this->CurrentLocalGenerator->GetCurrentBinaryDirectory(),
|
this->CurrentLocalGenerator->GetCurrentBinaryDirectory(),
|
||||||
this->ProjectOutputDirectoryComponents);
|
this->ProjectOutputDirectoryComponents);
|
||||||
|
@ -461,7 +462,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
||||||
mf->AddGeneratorTarget(allbuild, allBuildGt);
|
mf->AddGeneratorTarget(allbuild, allBuildGt);
|
||||||
|
|
||||||
// Refer to the main build configuration file for easy editing.
|
// Refer to the main build configuration file for easy editing.
|
||||||
std::string listfile = mf->GetCurrentSourceDirectory();
|
std::string listfile = root->GetCurrentSourceDirectory();
|
||||||
listfile += "/";
|
listfile += "/";
|
||||||
listfile += "CMakeLists.txt";
|
listfile += "CMakeLists.txt";
|
||||||
allBuildGt->AddSource(listfile.c_str());
|
allBuildGt->AddSource(listfile.c_str());
|
||||||
|
@ -557,7 +558,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
||||||
cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target);
|
cmGeneratorTarget* targetGT = this->GetGeneratorTarget(&target);
|
||||||
|
|
||||||
// Refer to the build configuration file for easy editing.
|
// Refer to the build configuration file for easy editing.
|
||||||
listfile = lg->GetMakefile()->GetCurrentSourceDirectory();
|
listfile = lg->GetCurrentSourceDirectory();
|
||||||
listfile += "/";
|
listfile += "/";
|
||||||
listfile += "CMakeLists.txt";
|
listfile += "CMakeLists.txt";
|
||||||
targetGT->AddSource(listfile.c_str());
|
targetGT->AddSource(listfile.c_str());
|
||||||
|
@ -3372,7 +3373,7 @@ bool cmGlobalXCodeGenerator
|
||||||
// Point Xcode at the top of the source tree.
|
// Point Xcode at the top of the source tree.
|
||||||
{
|
{
|
||||||
std::string pdir =
|
std::string pdir =
|
||||||
this->RelativeToBinary(root->GetMakefile()->GetCurrentSourceDirectory());
|
this->RelativeToBinary(root->GetCurrentSourceDirectory());
|
||||||
this->RootObject->AddAttribute("projectDirPath",
|
this->RootObject->AddAttribute("projectDirPath",
|
||||||
this->CreateString(pdir.c_str()));
|
this->CreateString(pdir.c_str()));
|
||||||
this->RootObject->AddAttribute("projectRoot", this->CreateString(""));
|
this->RootObject->AddAttribute("projectRoot", this->CreateString(""));
|
||||||
|
|
|
@ -2883,6 +2883,11 @@ const char* cmLocalGenerator::GetCurrentBinaryDirectory() const
|
||||||
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
|
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* cmLocalGenerator::GetCurrentSourceDirectory() const
|
||||||
|
{
|
||||||
|
return this->StateSnapshot.GetDirectory().GetCurrentSource();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
|
cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
|
||||||
|
|
|
@ -259,6 +259,7 @@ public:
|
||||||
const char* GetBinaryDirectory() const;
|
const char* GetBinaryDirectory() const;
|
||||||
|
|
||||||
const char* GetCurrentBinaryDirectory() const;
|
const char* GetCurrentBinaryDirectory() const;
|
||||||
|
const char* GetCurrentSourceDirectory() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a Mac OS X application bundle Info.plist file.
|
* Generate a Mac OS X application bundle Info.plist file.
|
||||||
|
|
|
@ -215,7 +215,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
|
||||||
dspname += ".dsp.cmake";
|
dspname += ".dsp.cmake";
|
||||||
cmCustomCommandLine commandLine;
|
cmCustomCommandLine commandLine;
|
||||||
commandLine.push_back(cmSystemTools::GetCMakeCommand());
|
commandLine.push_back(cmSystemTools::GetCMakeCommand());
|
||||||
std::string makefileIn = this->Makefile->GetCurrentSourceDirectory();
|
std::string makefileIn = this->GetCurrentSourceDirectory();
|
||||||
makefileIn += "/";
|
makefileIn += "/";
|
||||||
makefileIn += "CMakeLists.txt";
|
makefileIn += "CMakeLists.txt";
|
||||||
if(!cmSystemTools::FileExists(makefileIn.c_str()))
|
if(!cmSystemTools::FileExists(makefileIn.c_str()))
|
||||||
|
|
|
@ -282,7 +282,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
|
||||||
stampName += "generate.stamp";
|
stampName += "generate.stamp";
|
||||||
cmCustomCommandLine commandLine;
|
cmCustomCommandLine commandLine;
|
||||||
commandLine.push_back(cmSystemTools::GetCMakeCommand());
|
commandLine.push_back(cmSystemTools::GetCMakeCommand());
|
||||||
std::string makefileIn = this->Makefile->GetCurrentSourceDirectory();
|
std::string makefileIn = this->GetCurrentSourceDirectory();
|
||||||
makefileIn += "/";
|
makefileIn += "/";
|
||||||
makefileIn += "CMakeLists.txt";
|
makefileIn += "CMakeLists.txt";
|
||||||
makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str());
|
makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str());
|
||||||
|
|
|
@ -1114,7 +1114,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
|
||||||
<< this->Convert(this->LocalGenerator->GetSourceDirectory(),
|
<< this->Convert(this->LocalGenerator->GetSourceDirectory(),
|
||||||
cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
|
cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
|
||||||
<< " "
|
<< " "
|
||||||
<< this->Convert(this->Makefile->GetCurrentSourceDirectory(),
|
<< this->Convert(this->LocalGenerator->GetCurrentSourceDirectory(),
|
||||||
cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
|
cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
|
||||||
<< " "
|
<< " "
|
||||||
<< this->Convert(this->LocalGenerator->GetBinaryDirectory(),
|
<< this->Convert(this->LocalGenerator->GetBinaryDirectory(),
|
||||||
|
|
|
@ -45,8 +45,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
|
||||||
// We only want to process global targets that live in the home
|
// We only want to process global targets that live in the home
|
||||||
// (i.e. top-level) directory. CMake creates copies of these targets
|
// (i.e. top-level) directory. CMake creates copies of these targets
|
||||||
// in every directory, which we don't need.
|
// in every directory, which we don't need.
|
||||||
cmMakefile *mf = target->Target->GetMakefile();
|
if (strcmp(target->GetLocalGenerator()->GetCurrentSourceDirectory(),
|
||||||
if (strcmp(mf->GetCurrentSourceDirectory(),
|
|
||||||
target->GetLocalGenerator()->GetSourceDirectory()) == 0)
|
target->GetLocalGenerator()->GetSourceDirectory()) == 0)
|
||||||
return new cmNinjaUtilityTargetGenerator(target);
|
return new cmNinjaUtilityTargetGenerator(target);
|
||||||
// else fallthrough
|
// else fallthrough
|
||||||
|
|
|
@ -2243,7 +2243,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
|
||||||
{
|
{
|
||||||
// Look through the sources for AndroidManifest.xml and use
|
// Look through the sources for AndroidManifest.xml and use
|
||||||
// its location as the root source directory.
|
// its location as the root source directory.
|
||||||
std::string rootDir = this->Makefile->GetCurrentSourceDirectory();
|
std::string rootDir = this->LocalGenerator->GetCurrentSourceDirectory();
|
||||||
{
|
{
|
||||||
std::vector<cmSourceFile const*> extraSources;
|
std::vector<cmSourceFile const*> extraSources;
|
||||||
this->GeneratorTarget->GetExtraSources(extraSources, "");
|
this->GeneratorTarget->GetExtraSources(extraSources, "");
|
||||||
|
|
Loading…
Reference in New Issue