Merge topic 'add-cmLocalGenerator-API'

223d0efe Remove some needless GetMakefile() calls.
a367416c cmLocalGenerator: Add current source directory accessor.
bbef3c2d cmLocalGenerator: Add current binary directory accessor.
12cb3bdc cmLocalGenerator: Add Home directory accessors.
72efa15d Eclipse: Port API to cmLocalGenerator.
f2a641d6 Kate: Remove unused variables.
10cf42f5 Kate: Port API to cmLocalGenerator.
e46ef270 export: Port internal method to cmGeneratorTarget.
53d3a1c9 cmMakefile: Remove unused GetProjectName calls.
4ab2750c cmLocalGenerator: Add GetProjectName method.
c8187f41 cmCPluginAPI: Inline code to get project name.
8c6e6dd3 cmMakefile: Inline initialization of project name.
27916f2c cmLocalGenerator: Add cmake instance accessor.
This commit is contained in:
Brad King 2015-10-12 10:26:15 -04:00 committed by CMake Topic Stage
commit 762108f3ec
37 changed files with 277 additions and 244 deletions

View File

@ -116,7 +116,7 @@ const char* CCONV cmGetProjectName(void *arg)
{ {
cmMakefile *mf = static_cast<cmMakefile *>(arg); cmMakefile *mf = static_cast<cmMakefile *>(arg);
static std::string name; static std::string name;
name = mf->GetProjectName(); name = mf->GetStateSnapshot().GetProjectName();
return name.c_str(); return name.c_str();
} }

View File

@ -1975,8 +1975,9 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
else if(use_link_rpath) else if(use_link_rpath)
{ {
// Do not add any path inside the source or build tree. // Do not add any path inside the source or build tree.
const char* topSourceDir = this->Makefile->GetHomeDirectory(); const char* topSourceDir = this->CMakeInstance->GetHomeDirectory();
const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory(); const char* topBinaryDir =
this->CMakeInstance->GetHomeOutputDirectory();
if(!cmSystemTools::ComparePath(*ri, topSourceDir) && if(!cmSystemTools::ComparePath(*ri, topSourceDir) &&
!cmSystemTools::ComparePath(*ri, topBinaryDir) && !cmSystemTools::ComparePath(*ri, topBinaryDir) &&
!cmSystemTools::IsSubDirectory(*ri, topSourceDir) && !cmSystemTools::IsSubDirectory(*ri, topSourceDir) &&

View File

@ -101,7 +101,7 @@ cmCustomCommandGenerator
} }
else else
{ {
cmOutputConverter converter(this->LG->GetMakefile()->GetStateSnapshot()); cmOutputConverter converter(this->LG->GetStateSnapshot());
cmd += converter.EscapeForShell(arg, this->MakeVars); cmd += converter.EscapeForShell(arg, this->MakeVars);
} }
} }

View File

@ -160,7 +160,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends,
if (mod_dir.empty()) if (mod_dir.empty())
{ {
mod_dir = mod_dir =
this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory(); this->LocalGenerator->GetCurrentBinaryDirectory();
} }
// Actually write dependencies to the streams. // Actually write dependencies to the streams.

View File

@ -241,12 +241,14 @@ static bool isSubDirectory(const char* a, const char* b)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool checkInterfaceDirs(const std::string &prepro, static bool checkInterfaceDirs(const std::string &prepro,
cmTarget *target, const std::string& prop) cmGeneratorTarget *target, const std::string& prop)
{ {
const char* installDir = const char* installDir =
target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX"); target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
const char* topSourceDir = target->GetMakefile()->GetHomeDirectory(); const char* topSourceDir =
const char* topBinaryDir = target->GetMakefile()->GetHomeOutputDirectory(); target->GetLocalGenerator()->GetSourceDirectory();
const char* topBinaryDir =
target->GetLocalGenerator()->GetBinaryDirectory();
std::vector<std::string> parts; std::vector<std::string> parts;
cmGeneratorExpression::Split(prepro, parts); cmGeneratorExpression::Split(prepro, parts);
@ -269,7 +271,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{ {
if (prop == "INTERFACE_INCLUDE_DIRECTORIES") if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
{ {
switch (target->GetPolicyStatusCMP0041()) switch (target->Target->GetPolicyStatusCMP0041())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
messageType = cmake::WARNING; messageType = cmake::WARNING;
@ -298,7 +300,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains relative path:\n" " property contains relative path:\n"
" \"" << *li << "\""; " \"" << *li << "\"";
target->GetMakefile()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
bool inBinary = isSubDirectory(li->c_str(), topBinaryDir); bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
bool inSource = isSubDirectory(li->c_str(), topSourceDir); bool inSource = isSubDirectory(li->c_str(), topSourceDir);
@ -316,7 +318,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{ {
if (!shouldContinue) if (!shouldContinue)
{ {
switch(target->GetPolicyStatusCMP0052()) switch(target->Target->GetPolicyStatusCMP0052())
{ {
case cmPolicies::WARN: case cmPolicies::WARN:
{ {
@ -329,7 +331,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
"a subdirectory of the " << (inBinary ? "build" : "source") "a subdirectory of the " << (inBinary ? "build" : "source")
<< " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir) << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir)
<< "\"" << std::endl; << "\"" << std::endl;
target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, target->GetLocalGenerator()->IssueMessage(cmake::AUTHOR_WARNING,
s.str()); s.str());
} }
case cmPolicies::OLD: case cmPolicies::OLD:
@ -352,7 +354,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains path:\n" " property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the build directory."; " \"" << *li << "\"\nwhich is prefixed in the build directory.";
target->GetMakefile()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
if (!inSourceBuild) if (!inSourceBuild)
{ {
@ -361,7 +363,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
e << "Target \"" << target->GetName() << "\" " << prop << e << "Target \"" << target->GetName() << "\" " << prop <<
" property contains path:\n" " property contains path:\n"
" \"" << *li << "\"\nwhich is prefixed in the source directory."; " \"" << *li << "\"\nwhich is prefixed in the source directory.";
target->GetMakefile()->IssueMessage(messageType, e.str()); target->GetLocalGenerator()->IssueMessage(messageType, e.str());
} }
} }
} }
@ -421,7 +423,9 @@ void cmExportFileGenerator::PopulateSourcesInterface(
this->ResolveTargetsInGeneratorExpressions(prepro, target, this->ResolveTargetsInGeneratorExpressions(prepro, target,
missingTargets); missingTargets);
if (!checkInterfaceDirs(prepro, target, propName)) cmGeneratorTarget* gt = target->GetMakefile()
->GetGlobalGenerator()->GetGeneratorTarget(target);
if (!checkInterfaceDirs(prepro, gt, propName))
{ {
return; return;
} }
@ -491,7 +495,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
this->ResolveTargetsInGeneratorExpressions(prepro, target->Target, this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
missingTargets); missingTargets);
if (!checkInterfaceDirs(prepro, target->Target, propName)) if (!checkInterfaceDirs(prepro, target, propName))
{ {
return; return;
} }

View File

@ -76,9 +76,8 @@ void cmExtraCodeBlocksGenerator::Generate()
void cmExtraCodeBlocksGenerator::CreateProjectFile( void cmExtraCodeBlocksGenerator::CreateProjectFile(
const std::vector<cmLocalGenerator*>& lgs) const std::vector<cmLocalGenerator*>& lgs)
{ {
const cmMakefile* mf=lgs[0]->GetMakefile(); std::string outputDir=lgs[0]->GetCurrentBinaryDirectory();
std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectName=lgs[0]->GetProjectName();
std::string projectName=mf->GetProjectName();
std::string filename=outputDir+"/"; std::string filename=outputDir+"/";
filename+=projectName+".cbp"; filename+=projectName+".cbp";
@ -273,7 +272,7 @@ void cmExtraCodeBlocksGenerator
} }
const std::string &relative = cmSystemTools::RelativePath( const std::string &relative = cmSystemTools::RelativePath(
it->second[0]->GetMakefile()->GetHomeDirectory(), it->second[0]->GetSourceDirectory(),
jt->c_str()); jt->c_str());
std::vector<std::string> splitted; std::vector<std::string> splitted;
cmSystemTools::SplitPath(relative, splitted, false); cmSystemTools::SplitPath(relative, splitted, false);
@ -297,7 +296,7 @@ void cmExtraCodeBlocksGenerator
tree.BuildVirtualFolder(virtualFolders); tree.BuildVirtualFolder(virtualFolders);
// And one for <Unit> // And one for <Unit>
std::string unitFiles; std::string unitFiles;
tree.BuildUnit(unitFiles, std::string(mf->GetHomeDirectory()) + "/"); tree.BuildUnit(unitFiles, std::string(lgs[0]->GetSourceDirectory()) + "/");
// figure out the compiler // figure out the compiler
std::string compiler = this->GetCBCompilerId(mf); std::string compiler = this->GetCBCompilerId(mf);
@ -307,7 +306,7 @@ void cmExtraCodeBlocksGenerator
"<CodeBlocks_project_file>\n" "<CodeBlocks_project_file>\n"
" <FileVersion major=\"1\" minor=\"6\" />\n" " <FileVersion major=\"1\" minor=\"6\" />\n"
" <Project>\n" " <Project>\n"
" <Option title=\"" << mf->GetProjectName()<<"\" />\n" " <Option title=\"" << lgs[0]->GetProjectName()<<"\" />\n"
" <Option makefile_is_custom=\"1\" />\n" " <Option makefile_is_custom=\"1\" />\n"
" <Option compiler=\"" << compiler << "\" />\n" " <Option compiler=\"" << compiler << "\" />\n"
" "<<virtualFolders<<"\n" " "<<virtualFolders<<"\n"
@ -331,8 +330,8 @@ void cmExtraCodeBlocksGenerator
{ {
// Only add the global targets from CMAKE_BINARY_DIR, // Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs // not from the subdirs
if (strcmp(makefile->GetCurrentBinaryDirectory(), if (strcmp((*lg)->GetCurrentBinaryDirectory(),
makefile->GetHomeOutputDirectory())==0) (*lg)->GetBinaryDirectory())==0)
{ {
this->AppendTarget(fout, ti->first, 0, this->AppendTarget(fout, ti->first, 0,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
@ -524,11 +523,10 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile(
cmLocalGenerator* lg, cmLocalGenerator* lg,
cmTarget* target) const cmTarget* target) const
{ {
cmMakefile *mf = lg->GetMakefile();
// this file doesn't seem to be used by C::B in custom makefile mode, // this file doesn't seem to be used by C::B in custom makefile mode,
// but we generate a unique file for each OBJECT library so in case // but we generate a unique file for each OBJECT library so in case
// C::B uses it in some way, the targets don't interfere with each other. // C::B uses it in some way, the targets don't interfere with each other.
std::string filename = mf->GetCurrentBinaryDirectory(); std::string filename = lg->GetCurrentBinaryDirectory();
filename += "/"; filename += "/";
filename += lg->GetTargetDirectory(*target); filename += lg->GetTargetDirectory(*target);
filename += "/"; filename += "/";
@ -555,14 +553,14 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
const char* compiler) const char* compiler)
{ {
cmMakefile const* makefile = lg->GetMakefile(); cmMakefile const* makefile = lg->GetMakefile();
std::string makefileName = makefile->GetCurrentBinaryDirectory(); std::string makefileName = lg->GetCurrentBinaryDirectory();
makefileName += "/Makefile"; makefileName += "/Makefile";
fout<<" <Target title=\"" << targetName << "\">\n"; fout<<" <Target title=\"" << targetName << "\">\n";
if (target!=0) if (target!=0)
{ {
int cbTargetType = this->GetCBTargetType(target); int cbTargetType = this->GetCBTargetType(target);
std::string workingDir = makefile->GetCurrentBinaryDirectory(); std::string workingDir = lg->GetCurrentBinaryDirectory();
if ( target->GetType()==cmTarget::EXECUTABLE) if ( target->GetType()==cmTarget::EXECUTABLE)
{ {
// Determine the directory where the executable target is created, and // Determine the directory where the executable target is created, and
@ -659,7 +657,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
else // e.g. all and the GLOBAL and UTILITY targets else // e.g. all and the GLOBAL and UTILITY targets
{ {
fout<<" <Option working_dir=\"" fout<<" <Option working_dir=\""
<< makefile->GetCurrentBinaryDirectory() << "\" />\n" << lg->GetCurrentBinaryDirectory() << "\" />\n"
<<" <Option type=\"" << 4 << "\" />\n"; <<" <Option type=\"" << 4 << "\" />\n";
} }

View File

@ -68,15 +68,15 @@ void cmExtraCodeLiteGenerator::Generate()
const cmMakefile* mf =it->second[0]->GetMakefile(); const cmMakefile* mf =it->second[0]->GetMakefile();
this->ConfigName = GetConfigurationName( mf ); this->ConfigName = GetConfigurationName( mf );
if (strcmp(mf->GetCurrentBinaryDirectory(), if (strcmp(it->second[0]->GetCurrentBinaryDirectory(),
mf->GetHomeOutputDirectory()) == 0) it->second[0]->GetBinaryDirectory()) == 0)
{ {
workspaceOutputDir = mf->GetCurrentBinaryDirectory(); workspaceOutputDir = it->second[0]->GetCurrentBinaryDirectory();
workspaceProjectName = mf->GetProjectName(); workspaceProjectName = it->second[0]->GetProjectName();
workspaceSourcePath = mf->GetHomeDirectory(); workspaceSourcePath = it->second[0]->GetSourceDirectory();
workspaceFileName = workspaceOutputDir+"/"; workspaceFileName = workspaceOutputDir+"/";
workspaceFileName += workspaceProjectName + ".workspace"; workspaceFileName += workspaceProjectName + ".workspace";
this->WorkspacePath = mf->GetCurrentBinaryDirectory();; this->WorkspacePath = it->second[0]->GetCurrentBinaryDirectory();;
fout.Open(workspaceFileName.c_str(), false, false); fout.Open(workspaceFileName.c_str(), false, false);
fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
@ -91,9 +91,8 @@ void cmExtraCodeLiteGenerator::Generate()
++it) ++it)
{ {
// retrive project information // retrive project information
const cmMakefile* mf = it->second[0]->GetMakefile(); std::string outputDir = it->second[0]->GetCurrentBinaryDirectory();
std::string outputDir = mf->GetCurrentBinaryDirectory(); std::string projectName = it->second[0]->GetProjectName();
std::string projectName = mf->GetProjectName();
std::string filename = outputDir + "/" + projectName + ".project"; std::string filename = outputDir + "/" + projectName + ".project";
// Make the project file relative to the workspace // Make the project file relative to the workspace
@ -121,9 +120,8 @@ void cmExtraCodeLiteGenerator::Generate()
void cmExtraCodeLiteGenerator::CreateProjectFile( void cmExtraCodeLiteGenerator::CreateProjectFile(
const std::vector<cmLocalGenerator*>& lgs) const std::vector<cmLocalGenerator*>& lgs)
{ {
const cmMakefile* mf = lgs[0]->GetMakefile(); std::string outputDir = lgs[0]->GetCurrentBinaryDirectory();
std::string outputDir = mf->GetCurrentBinaryDirectory(); std::string projectName = lgs[0]->GetProjectName();
std::string projectName = mf->GetProjectName();
std::string filename = outputDir + "/"; std::string filename = outputDir + "/";
filename += projectName + ".project"; filename += projectName + ".project";
@ -143,7 +141,7 @@ void cmExtraCodeLiteGenerator
//////////////////////////////////// ////////////////////////////////////
fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<CodeLite_Project Name=\"" << mf->GetProjectName() "<CodeLite_Project Name=\"" << lgs[0]->GetProjectName()
<< "\" InternalType=\"\">\n"; << "\" InternalType=\"\">\n";
// Collect all used source files in the project // Collect all used source files in the project

View File

@ -79,8 +79,8 @@ void cmExtraEclipseCDT4Generator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::Generate() void cmExtraEclipseCDT4Generator::Generate()
{ {
const cmMakefile* mf cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
= this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); const cmMakefile* mf = lg->GetMakefile();
std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION"); std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION");
cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*"); cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*");
@ -106,8 +106,8 @@ void cmExtraEclipseCDT4Generator::Generate()
} }
// TODO: Decide if these are local or member variables // TODO: Decide if these are local or member variables
this->HomeDirectory = mf->GetHomeDirectory(); this->HomeDirectory = lg->GetSourceDirectory();
this->HomeOutputDirectory = mf->GetHomeOutputDirectory(); this->HomeOutputDirectory = lg->GetBinaryDirectory();
this->GenerateLinkedResources = mf->IsOn( this->GenerateLinkedResources = mf->IsOn(
"CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES"); "CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES");
@ -157,9 +157,8 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
assert(this->HomeDirectory != this->HomeOutputDirectory); assert(this->HomeDirectory != this->HomeOutputDirectory);
// set up the project name: <project>-Source@<baseSourcePathName> // set up the project name: <project>-Source@<baseSourcePathName>
const cmMakefile* mf cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
= this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); std::string name = this->GenerateProjectName(lg->GetProjectName(), "Source",
std::string name = this->GenerateProjectName(mf->GetProjectName(), "Source",
this->GetPathBasename(this->HomeDirectory)); this->GetPathBasename(this->HomeDirectory));
const std::string filename = this->HomeDirectory + "/.project"; const std::string filename = this->HomeDirectory + "/.project";
@ -197,8 +196,11 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
const char* envVar, cmMakefile* mf) const char* envVar,
cmLocalGenerator* lg)
{ {
cmMakefile* mf = lg->GetMakefile();
// get the variables from the environment and from the cache and then // get the variables from the environment and from the cache and then
// figure out which one to use: // figure out which one to use:
@ -206,7 +208,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_";
cacheEntryName += envVar; cacheEntryName += envVar;
const char* cacheValue = mf->GetState()->GetInitializedCacheValue( const char* cacheValue = lg->GetState()->GetInitializedCacheValue(
cacheEntryName); cacheEntryName);
// now we have both, decide which one to use // now we have both, decide which one to use
@ -224,7 +226,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
cacheEntryName.c_str(), cmState::STRING, cacheEntryName.c_str(), cmState::STRING,
true); true);
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
} }
else if (envVarValue==0 && cacheValue!=0) else if (envVarValue==0 && cacheValue!=0)
{ {
@ -245,7 +247,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
cacheEntryName.c_str(), cmState::STRING, cacheEntryName.c_str(), cmState::STRING,
true); true);
mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory()); mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
} }
} }
@ -259,8 +261,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::CreateProjectFile() void cmExtraEclipseCDT4Generator::CreateProjectFile()
{ {
cmMakefile* mf cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
= this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
const std::string filename = this->HomeOutputDirectory + "/.project"; const std::string filename = this->HomeOutputDirectory + "/.project";
@ -280,7 +282,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<projectDescription>\n" "<projectDescription>\n"
"\t<name>" << "\t<name>" <<
this->GenerateProjectName(mf->GetProjectName(), this->GenerateProjectName(lg->GetProjectName(),
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(this->HomeOutputDirectory)) this->GetPathBasename(this->HomeOutputDirectory))
<< "</name>\n" << "</name>\n"
@ -361,17 +363,17 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
// but not necessarily when eclipse is open // but not necessarily when eclipse is open
if (compilerId == "MSVC") if (compilerId == "MSVC")
{ {
AddEnvVar(fout, "PATH", mf); AddEnvVar(fout, "PATH", lg);
AddEnvVar(fout, "INCLUDE", mf); AddEnvVar(fout, "INCLUDE", lg);
AddEnvVar(fout, "LIB", mf); AddEnvVar(fout, "LIB", lg);
AddEnvVar(fout, "LIBPATH", mf); AddEnvVar(fout, "LIBPATH", lg);
} }
else if (compilerId == "Intel") else if (compilerId == "Intel")
{ {
// if the env.var is set, use this one and put it in the cache // if the env.var is set, use this one and put it in the cache
// if the env.var is not set, but the value is in the cache, // if the env.var is not set, but the value is in the cache,
// use it from the cache: // use it from the cache:
AddEnvVar(fout, "INTEL_LICENSE_FILE", mf); AddEnvVar(fout, "INTEL_LICENSE_FILE", lg);
} }
fout << fout <<
"</value>\n" "</value>\n"
@ -495,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))
@ -636,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) &&
@ -696,8 +698,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{ {
std::set<std::string> emmited; std::set<std::string> emmited;
const cmMakefile* mf cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
= this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); const cmMakefile* mf = lg->GetMakefile();
const std::string filename = this->HomeOutputDirectory + "/.cproject"; const std::string filename = this->HomeOutputDirectory + "/.cproject";
@ -1034,8 +1036,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
++it) ++it)
{ {
const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
cmMakefile* makefile=(*it)->GetMakefile(); std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(),
std::string subdir = (*it)->Convert(makefile->GetCurrentBinaryDirectory(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
if (subdir == ".") if (subdir == ".")
{ {
@ -1089,14 +1090,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
virtDir += prefix; virtDir += prefix;
virtDir += ti->first; virtDir += ti->first;
std::string buildArgs = "-C \""; std::string buildArgs = "-C \"";
buildArgs += makefile->GetHomeOutputDirectory(); buildArgs += (*it)->GetBinaryDirectory();
buildArgs += "\" "; buildArgs += "\" ";
buildArgs += makeArgs; buildArgs += makeArgs;
this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "", this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",
ti->first.c_str()); ti->first.c_str());
std::string cleanArgs = "-E chdir \""; std::string cleanArgs = "-E chdir \"";
cleanArgs += makefile->GetCurrentBinaryDirectory(); cleanArgs += (*it)->GetCurrentBinaryDirectory();
cleanArgs += "\" \""; cleanArgs += "\" \"";
cleanArgs += cmSystemTools::GetCMakeCommand(); cleanArgs += cmSystemTools::GetCMakeCommand();
cleanArgs += "\" -P \""; cleanArgs += "\" -P \"";
@ -1151,8 +1152,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
fout << "</cconfiguration>\n" fout << "</cconfiguration>\n"
"</storageModule>\n" "</storageModule>\n"
"<storageModule moduleId=\"cdtBuildSystem\" version=\"4.0.0\">\n" "<storageModule moduleId=\"cdtBuildSystem\" version=\"4.0.0\">\n"
"<project id=\"" << this->EscapeForXML(mf->GetProjectName()) "<project id=\"" << this->EscapeForXML(lg->GetProjectName())
<< ".null.1\" name=\"" << this->EscapeForXML(mf->GetProjectName()) << ".null.1\" name=\"" << this->EscapeForXML(lg->GetProjectName())
<< "\"/>\n" << "\"/>\n"
"</storageModule>\n" "</storageModule>\n"
"</cproject>\n" "</cproject>\n"

View File

@ -100,7 +100,7 @@ private:
std::set<std::string>& emittedDirs); std::set<std::string>& emittedDirs);
static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar, static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf); cmLocalGenerator* lg);
void CreateLinksToSubprojects(cmGeneratedFileStream& fout, void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
const std::string& baseDir); const std::string& baseDir);

View File

@ -46,21 +46,22 @@ cmExtraKateGenerator::cmExtraKateGenerator()
void cmExtraKateGenerator::Generate() void cmExtraKateGenerator::Generate()
{ {
const cmMakefile* mf cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
= this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); const cmMakefile* mf = lg->GetMakefile();
this->ProjectName = this->GenerateProjectName(mf->GetProjectName(), this->ProjectName = this->GenerateProjectName(lg->GetProjectName(),
mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
this->GetPathBasename(mf->GetHomeOutputDirectory())); this->GetPathBasename(lg->GetBinaryDirectory()));
this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja"); this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja");
this->CreateKateProjectFile(mf); this->CreateKateProjectFile(lg);
this->CreateDummyKateProjectFile(mf); this->CreateDummyKateProjectFile(lg);
} }
void cmExtraKateGenerator::CreateKateProjectFile(const cmMakefile* mf) const void cmExtraKateGenerator::CreateKateProjectFile(
const cmLocalGenerator* lg) const
{ {
std::string filename = mf->GetHomeOutputDirectory(); std::string filename = lg->GetBinaryDirectory();
filename += "/.kateproject"; filename += "/.kateproject";
cmGeneratedFileStream fout(filename.c_str()); cmGeneratedFileStream fout(filename.c_str());
if (!fout) if (!fout)
@ -68,31 +69,29 @@ void cmExtraKateGenerator::CreateKateProjectFile(const cmMakefile* mf) const
return; return;
} }
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
std::string args = mf->GetSafeDefinition("CMAKE_KATE_MAKE_ARGUMENTS");
fout << fout <<
"{\n" "{\n"
"\t\"name\": \"" << this->ProjectName << "\",\n" "\t\"name\": \"" << this->ProjectName << "\",\n"
"\t\"directory\": \"" << mf->GetHomeDirectory() << "\",\n" "\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n"
"\t\"files\": [ { " << this->GenerateFilesString(mf) << "} ],\n"; "\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n";
this->WriteTargets(mf, fout); this->WriteTargets(lg, fout);
fout << "}\n"; fout << "}\n";
} }
void void
cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
cmGeneratedFileStream& fout) const cmGeneratedFileStream& fout) const
{ {
cmMakefile const* mf = lg->GetMakefile();
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
const std::string makeArgs = mf->GetSafeDefinition( const std::string makeArgs = mf->GetSafeDefinition(
"CMAKE_KATE_MAKE_ARGUMENTS"); "CMAKE_KATE_MAKE_ARGUMENTS");
const char* homeOutputDir = mf->GetHomeOutputDirectory(); const char* homeOutputDir = lg->GetBinaryDirectory();
fout << fout <<
"\t\"build\": {\n" "\t\"build\": {\n"
"\t\t\"directory\": \"" << mf->GetHomeOutputDirectory() << "\",\n" "\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n"
"\t\t\"default_target\": \"all\",\n" "\t\t\"default_target\": \"all\",\n"
"\t\t\"clean_target\": \"clean\",\n"; "\t\t\"clean_target\": \"clean\",\n";
@ -122,8 +121,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
{ {
const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
cmMakefile* makefile=(*it)->GetMakefile(); cmMakefile* makefile=(*it)->GetMakefile();
std::string currentDir = makefile->GetCurrentBinaryDirectory(); std::string currentDir = (*it)->GetCurrentBinaryDirectory();
bool topLevel = (currentDir == makefile->GetHomeOutputDirectory()); bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti)
{ {
@ -234,9 +233,10 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
void void
cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const cmExtraKateGenerator::CreateDummyKateProjectFile(
const cmLocalGenerator* lg) const
{ {
std::string filename = mf->GetHomeOutputDirectory(); std::string filename = lg->GetBinaryDirectory();
filename += "/"; filename += "/";
filename += this->ProjectName; filename += this->ProjectName;
filename += ".kateproject"; filename += ".kateproject";
@ -252,23 +252,23 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const
std::string std::string
cmExtraKateGenerator::GenerateFilesString(const cmMakefile* mf) const cmExtraKateGenerator::GenerateFilesString(const cmLocalGenerator* lg) const
{ {
std::string s = mf->GetHomeDirectory(); std::string s = lg->GetSourceDirectory();
s += "/.git"; s += "/.git";
if(cmSystemTools::FileExists(s.c_str())) if(cmSystemTools::FileExists(s.c_str()))
{ {
return std::string("\"git\": 1 "); return std::string("\"git\": 1 ");
} }
s = mf->GetHomeDirectory(); s = lg->GetSourceDirectory();
s += "/.svn"; s += "/.svn";
if(cmSystemTools::FileExists(s.c_str())) if(cmSystemTools::FileExists(s.c_str()))
{ {
return std::string("\"svn\": 1 "); return std::string("\"svn\": 1 ");
} }
s = mf->GetHomeDirectory(); s = lg->GetSourceDirectory();
s += "/"; s += "/";
std::set<std::string> files; std::set<std::string> files;

View File

@ -39,9 +39,10 @@ public:
virtual void Generate(); virtual void Generate();
private: private:
void CreateKateProjectFile(const cmMakefile* mf) const; void CreateKateProjectFile(const cmLocalGenerator* lg) const;
void CreateDummyKateProjectFile(const cmMakefile* mf) const; void CreateDummyKateProjectFile(const cmLocalGenerator* lg) const;
void WriteTargets(const cmMakefile* mf, cmGeneratedFileStream& fout) const; void WriteTargets(const cmLocalGenerator* lg,
cmGeneratedFileStream& fout) const;
void AppendTarget(cmGeneratedFileStream& fout, void AppendTarget(cmGeneratedFileStream& fout,
const std::string& target, const std::string& target,
const std::string& make, const std::string& make,
@ -49,7 +50,7 @@ private:
const std::string& path, const std::string& path,
const char* homeOutputDir) const; const char* homeOutputDir) const;
std::string GenerateFilesString(const cmMakefile* mf) const; std::string GenerateFilesString(const cmLocalGenerator* lg) const;
std::string GetPathBasename(const std::string& path) const; std::string GetPathBasename(const std::string& path) const;
std::string GenerateProjectName(const std::string& name, std::string GenerateProjectName(const std::string& name,
const std::string& type, const std::string& type,

View File

@ -77,9 +77,8 @@ void cmExtraSublimeTextGenerator::Generate()
void cmExtraSublimeTextGenerator::CreateProjectFile( void cmExtraSublimeTextGenerator::CreateProjectFile(
const std::vector<cmLocalGenerator*>& lgs) const std::vector<cmLocalGenerator*>& lgs)
{ {
const cmMakefile* mf=lgs[0]->GetMakefile(); std::string outputDir=lgs[0]->GetCurrentBinaryDirectory();
std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectName=lgs[0]->GetProjectName();
std::string projectName=mf->GetProjectName();
const std::string filename = const std::string filename =
outputDir + "/" + projectName + ".sublime-project"; outputDir + "/" + projectName + ".sublime-project";
@ -99,8 +98,8 @@ void cmExtraSublimeTextGenerator
} }
const std::string &sourceRootRelativeToOutput = cmSystemTools::RelativePath( const std::string &sourceRootRelativeToOutput = cmSystemTools::RelativePath(
mf->GetHomeOutputDirectory(), lgs[0]->GetBinaryDirectory(),
mf->GetHomeDirectory()); lgs[0]->GetSourceDirectory());
// Write the folder entries to the project file // Write the folder entries to the project file
fout << "{\n"; fout << "{\n";
fout << "\t\"folders\":\n\t[\n\t"; fout << "\t\"folders\":\n\t[\n\t";
@ -108,8 +107,8 @@ void cmExtraSublimeTextGenerator
{ {
fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\""; fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\"";
const std::string &outputRelativeToSourceRoot = const std::string &outputRelativeToSourceRoot =
cmSystemTools::RelativePath(mf->GetHomeDirectory(), cmSystemTools::RelativePath(lgs[0]->GetSourceDirectory(),
mf->GetHomeOutputDirectory()); lgs[0]->GetBinaryDirectory());
if ((!outputRelativeToSourceRoot.empty()) && if ((!outputRelativeToSourceRoot.empty()) &&
((outputRelativeToSourceRoot.length() < 3) || ((outputRelativeToSourceRoot.length() < 3) ||
(outputRelativeToSourceRoot.substr(0, 3) != "../"))) (outputRelativeToSourceRoot.substr(0, 3) != "../")))
@ -173,8 +172,8 @@ void cmExtraSublimeTextGenerator::
{ {
// Only add the global targets from CMAKE_BINARY_DIR, // Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs // not from the subdirs
if (strcmp(makefile->GetCurrentBinaryDirectory(), if (strcmp((*lg)->GetCurrentBinaryDirectory(),
makefile->GetHomeOutputDirectory())==0) (*lg)->GetBinaryDirectory())==0)
{ {
this->AppendTarget(fout, ti->first, *lg, 0, this->AppendTarget(fout, ti->first, *lg, 0,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
@ -302,7 +301,7 @@ void cmExtraSublimeTextGenerator::
{ {
fout << ",\n\t"; fout << ",\n\t";
} }
fout << "\t{\n\t\t\t\"name\": \"" << makefile->GetProjectName() << " - " << fout << "\t{\n\t\t\t\"name\": \"" << lg->GetProjectName() << " - " <<
targetName << "\",\n"; targetName << "\",\n";
fout << "\t\t\t\"cmd\": [" << fout << "\t\t\t\"cmd\": [" <<
this->BuildMakeCommand(make, makefileName.c_str(), targetName) << this->BuildMakeCommand(make, makefileName.c_str(), targetName) <<

View File

@ -139,7 +139,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator *lg)
{ {
std::ostringstream e; std::ostringstream e;
e << "Evaluation file \"" << this->Input << "\" cannot be read."; e << "Evaluation file \"" << this->Input << "\" cannot be read.";
lg->GetMakefile()->IssueMessage(cmake::FATAL_ERROR, e.str()); lg->IssueMessage(cmake::FATAL_ERROR, e.str());
return; return;
} }

View File

@ -68,7 +68,9 @@ cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
std::string std::string
cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target) cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target)
{ {
return target->GetMakefile()->GetHomeOutputDirectory(); cmGeneratorTarget* gt = target->GetMakefile()->GetGlobalGenerator()
->GetGeneratorTarget(target);
return gt->GetLocalGenerator()->GetBinaryDirectory();
} }
std::string std::string
@ -450,7 +452,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
cmSystemTools::ConvertToUnixSlashes(sgPath); cmSystemTools::ConvertToUnixSlashes(sgPath);
cmGlobalGhsMultiGenerator::AddFilesUpToPath( cmGlobalGhsMultiGenerator::AddFilesUpToPath(
this->GetFolderBuildStreams(), &this->FolderBuildStreams, this->GetFolderBuildStreams(), &this->FolderBuildStreams,
this->Makefile->GetHomeOutputDirectory(), sgPath, this->LocalGenerator->GetBinaryDirectory(), sgPath,
GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath); GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
std::string fullSourcePath((*si)->GetFullPath()); std::string fullSourcePath((*si)->GetFullPath());

View File

@ -399,7 +399,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
bool fatalError = false; bool fatalError = false;
mf->AddDefinition("RUN_CONFIGURE", true); mf->AddDefinition("RUN_CONFIGURE", true);
std::string rootBin = mf->GetHomeOutputDirectory(); std::string rootBin = this->CMakeInstance->GetHomeOutputDirectory();
rootBin += cmake::GetCMakeFilesDirectory(); rootBin += cmake::GetCMakeFilesDirectory();
// If the configuration files path has been set, // If the configuration files path has been set,
@ -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;
@ -2879,10 +2879,8 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalGenerator::WriteSummary() void cmGlobalGenerator::WriteSummary()
{ {
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
// Record all target directories in a central location. // Record all target directories in a central location.
std::string fname = mf->GetHomeOutputDirectory(); std::string fname = this->CMakeInstance->GetHomeOutputDirectory();
fname += cmake::GetCMakeFilesDirectory(); fname += cmake::GetCMakeFilesDirectory();
fname += "/TargetDirectories.txt"; fname += "/TargetDirectories.txt";
cmGeneratedFileStream fout(fname.c_str()); cmGeneratedFileStream fout(fname.c_str());

View File

@ -49,10 +49,9 @@ void cmGlobalKdevelopGenerator::Generate()
it!= this->GlobalGenerator->GetProjectMap().end(); it!= this->GlobalGenerator->GetProjectMap().end();
++it) ++it)
{ {
cmMakefile* mf = it->second[0]->GetMakefile(); std::string outputDir=it->second[0]->GetCurrentBinaryDirectory();
std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectDir=it->second[0]->GetSourceDirectory();
std::string projectDir=mf->GetHomeDirectory(); std::string projectName=it->second[0]->GetProjectName();
std::string projectName=mf->GetProjectName();
std::string cmakeFilePattern("CMakeLists.txt;*.cmake;"); std::string cmakeFilePattern("CMakeLists.txt;*.cmake;");
std::string fileToOpen; std::string fileToOpen;
const std::vector<cmLocalGenerator*>& lgs= it->second; const std::vector<cmLocalGenerator*>& lgs= it->second;

View File

@ -1198,16 +1198,15 @@ void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
{ {
cmLocalGenerator *lg = this->LocalGenerators[0]; cmLocalGenerator *lg = this->LocalGenerators[0];
cmMakefile* mfRoot = lg->GetMakefile();
std::ostringstream cmd; std::ostringstream cmd;
cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(), cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
cmLocalGenerator::SHELL) cmLocalGenerator::SHELL)
<< " -H" << " -H"
<< lg->ConvertToOutputFormat(mfRoot->GetHomeDirectory(), << lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
cmLocalGenerator::SHELL) cmLocalGenerator::SHELL)
<< " -B" << " -B"
<< lg->ConvertToOutputFormat(mfRoot->GetHomeOutputDirectory(), << lg->ConvertToOutputFormat(lg->GetBinaryDirectory(),
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
WriteRule(*this->RulesFileStream, WriteRule(*this->RulesFileStream,
"RERUN_CMAKE", "RERUN_CMAKE",

View File

@ -163,7 +163,7 @@ void cmGlobalUnixMakefileGenerator3::Generate()
{ {
cmLocalUnixMakefileGenerator3 *lg = cmLocalUnixMakefileGenerator3 *lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
std::string markFileName = lg->GetMakefile()->GetCurrentBinaryDirectory(); std::string markFileName = lg->GetCurrentBinaryDirectory();
markFileName += "/"; markFileName += "/";
markFileName += cmake::GetCMakeFilesDirectory(); markFileName += cmake::GetCMakeFilesDirectory();
markFileName += "/progress.marks"; markFileName += "/progress.marks";
@ -395,7 +395,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
{ {
lg = lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
tmpStr = lg->GetMakefile()->GetCurrentBinaryDirectory(); tmpStr = lg->GetCurrentBinaryDirectory();
tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += cmake::GetCMakeFilesDirectory();
tmpStr += "/CMakeDirectoryInformation.cmake"; tmpStr += "/CMakeDirectoryInformation.cmake";
cmakefileStream << " \"" << cmakefileStream << " \"" <<
@ -454,7 +454,7 @@ cmGlobalUnixMakefileGenerator3
bool check_relink) bool check_relink)
{ {
// Get the relative path to the subdirectory from the top. // Get the relative path to the subdirectory from the top.
std::string makeTarget = lg->GetMakefile()->GetCurrentBinaryDirectory(); std::string makeTarget = lg->GetCurrentBinaryDirectory();
makeTarget += "/"; makeTarget += "/";
makeTarget += pass; makeTarget += pass;
@ -495,7 +495,7 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the directory-level // The directory-level rule should depend on the directory-level
// rules of the subdirectories. // rules of the subdirectories.
std::vector<cmState::Snapshot> children std::vector<cmState::Snapshot> children
= lg->GetMakefile()->GetStateSnapshot().GetChildren(); = lg->GetStateSnapshot().GetChildren();
for(std::vector<cmState::Snapshot>::const_iterator for(std::vector<cmState::Snapshot>::const_iterator
ci = children.begin(); ci != children.end(); ++ci) ci = children.begin(); ci != children.end(); ++ci)
{ {
@ -534,7 +534,7 @@ cmGlobalUnixMakefileGenerator3
} }
// Begin the directory-level rules section. // Begin the directory-level rules section.
std::string dir = lg->GetMakefile()->GetCurrentBinaryDirectory(); std::string dir = lg->GetCurrentBinaryDirectory();
dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT, dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT,
cmLocalGenerator::MAKERULE); cmLocalGenerator::MAKERULE);
lg->WriteDivider(ruleFileStream); lg->WriteDivider(ruleFileStream);
@ -784,7 +784,7 @@ cmGlobalUnixMakefileGenerator3
depends.clear(); depends.clear();
cmLocalUnixMakefileGenerator3::EchoProgress progress; cmLocalUnixMakefileGenerator3::EchoProgress progress;
progress.Dir = lg->GetMakefile()->GetHomeOutputDirectory(); progress.Dir = lg->GetBinaryDirectory();
progress.Dir += cmake::GetCMakeFilesDirectory(); progress.Dir += cmake::GetCMakeFilesDirectory();
{ {
std::ostringstream progressArg; std::ostringstream progressArg;

View File

@ -260,7 +260,7 @@ void cmGlobalVisualStudio6Generator
} }
std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory(); std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory();
fname += "/"; fname += "/";
fname += root->GetMakefile()->GetProjectName(); fname += root->GetProjectName();
fname += ".dsw"; fname += ".dsw";
cmsys::ofstream fout(fname.c_str()); cmsys::ofstream fout(fname.c_str());
if(!fout) if(!fout)

View File

@ -362,10 +362,10 @@ void cmGlobalVisualStudio7Generator
{ {
return; return;
} }
this->CurrentProject = root->GetMakefile()->GetProjectName(); this->CurrentProject = root->GetProjectName();
std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory(); std::string fname = root->GetCurrentBinaryDirectory();
fname += "/"; fname += "/";
fname += root->GetMakefile()->GetProjectName(); fname += root->GetProjectName();
fname += ".sln"; fname += ".sln";
cmGeneratedFileStream fout(fname.c_str()); cmGeneratedFileStream fout(fname.c_str());
fout.SetCopyIfDifferent(true); fout.SetCopyIfDifferent(true);
@ -468,8 +468,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
target->GetProperty("GENERATOR_FILE_NAME"); target->GetProperty("GENERATOR_FILE_NAME");
if(vcprojName) if(vcprojName)
{ {
cmMakefile* tmf = target->GetMakefile(); cmLocalGenerator* lg =
std::string dir = tmf->GetCurrentBinaryDirectory(); root->GetGlobalGenerator()->GetGeneratorTarget(target)
->GetLocalGenerator();
std::string dir = lg->GetCurrentBinaryDirectory();
dir = root->Convert(dir.c_str(), dir = root->Convert(dir.c_str(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
if(dir == ".") if(dir == ".")

View File

@ -312,10 +312,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmCustomCommandLine commandLine; cmCustomCommandLine commandLine;
commandLine.push_back(cmSystemTools::GetCMakeCommand()); commandLine.push_back(cmSystemTools::GetCMakeCommand());
std::string argH = "-H"; std::string argH = "-H";
argH += mf->GetHomeDirectory(); argH += lg->GetSourceDirectory();
commandLine.push_back(argH); commandLine.push_back(argH);
std::string argB = "-B"; std::string argB = "-B";
argB += mf->GetHomeOutputDirectory(); argB += lg->GetBinaryDirectory();
commandLine.push_back(argB); commandLine.push_back(argB);
commandLine.push_back("--check-stamp-list"); commandLine.push_back("--check-stamp-list");
commandLine.push_back(stampList.c_str()); commandLine.push_back(stampList.c_str());

View File

@ -250,7 +250,7 @@ cmGlobalVisualStudioGenerator
{ {
topLevelSlnName = mf->GetCurrentBinaryDirectory(); topLevelSlnName = mf->GetCurrentBinaryDirectory();
topLevelSlnName += "/"; topLevelSlnName += "/";
topLevelSlnName += mf->GetProjectName(); topLevelSlnName += this->LocalGenerators[0]->GetProjectName();
topLevelSlnName += ".sln"; topLevelSlnName += ".sln";
} }

View File

@ -410,15 +410,17 @@ void cmGlobalXCodeGenerator::Generate()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
{ {
this->CurrentProject = root->GetMakefile()->GetProjectName(); this->CurrentProject = root->GetProjectName();
this->SetCurrentLocalGenerator(root); this->SetCurrentLocalGenerator(root);
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(), cmSystemTools::SplitPath(
this->ProjectSourceDirectoryComponents); this->CurrentLocalGenerator->GetCurrentSourceDirectory(),
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentBinaryDirectory(), this->ProjectSourceDirectoryComponents);
this->ProjectOutputDirectoryComponents); cmSystemTools::SplitPath(
this->CurrentLocalGenerator->GetCurrentBinaryDirectory(),
this->ProjectOutputDirectoryComponents);
this->CurrentXCodeHackMakefile = this->CurrentXCodeHackMakefile =
root->GetMakefile()->GetCurrentBinaryDirectory(); root->GetCurrentBinaryDirectory();
this->CurrentXCodeHackMakefile += "/CMakeScripts"; this->CurrentXCodeHackMakefile += "/CMakeScripts";
cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile.c_str()); cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile.c_str());
this->CurrentXCodeHackMakefile += "/XCODE_DEPEND_HELPER.make"; this->CurrentXCodeHackMakefile += "/XCODE_DEPEND_HELPER.make";
@ -460,13 +462,13 @@ 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());
// Add XCODE depend helper // Add XCODE depend helper
std::string dir = mf->GetCurrentBinaryDirectory(); std::string dir = root->GetCurrentBinaryDirectory();
cmCustomCommandLine makeHelper; cmCustomCommandLine makeHelper;
if(this->XcodeVersion < 50) if(this->XcodeVersion < 50)
{ {
@ -556,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());
@ -568,7 +570,6 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
void cmGlobalXCodeGenerator::CreateReRunCMakeFile( void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens) cmLocalGenerator* root, std::vector<cmLocalGenerator*> const& gens)
{ {
cmMakefile* mf = root->GetMakefile();
std::vector<std::string> lfiles; std::vector<std::string> lfiles;
for(std::vector<cmLocalGenerator*>::const_iterator gi = gens.begin(); for(std::vector<cmLocalGenerator*>::const_iterator gi = gens.begin();
gi != gens.end(); ++gi) gi != gens.end(); ++gi)
@ -582,7 +583,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
std::vector<std::string>::iterator new_end = std::vector<std::string>::iterator new_end =
std::unique(lfiles.begin(), lfiles.end()); std::unique(lfiles.begin(), lfiles.end());
lfiles.erase(new_end, lfiles.end()); lfiles.erase(new_end, lfiles.end());
this->CurrentReRunCMakeMakefile = mf->GetCurrentBinaryDirectory(); this->CurrentReRunCMakeMakefile = root->GetCurrentBinaryDirectory();
this->CurrentReRunCMakeMakefile += "/CMakeScripts"; this->CurrentReRunCMakeMakefile += "/CMakeScripts";
cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str()); cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str());
this->CurrentReRunCMakeMakefile += "/ReRunCMake.make"; this->CurrentReRunCMakeMakefile += "/ReRunCMake.make";
@ -590,7 +591,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
(this->CurrentReRunCMakeMakefile.c_str()); (this->CurrentReRunCMakeMakefile.c_str());
makefileStream.SetCopyIfDifferent(true); makefileStream.SetCopyIfDifferent(true);
makefileStream << "# Generated by CMake, DO NOT EDIT\n"; makefileStream << "# Generated by CMake, DO NOT EDIT\n";
std::string checkCache = mf->GetHomeOutputDirectory(); std::string checkCache = root->GetBinaryDirectory();
checkCache += "/"; checkCache += "/";
checkCache += cmake::GetCMakeFilesDirectoryPostSlash(); checkCache += cmake::GetCMakeFilesDirectoryPostSlash();
checkCache += "cmake.check_cache"; checkCache += "cmake.check_cache";
@ -604,9 +605,9 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
makefileStream << "\n\t" << makefileStream << "\n\t" <<
this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand().c_str()) this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand().c_str())
<< " -H" << this->ConvertToRelativeForMake( << " -H" << this->ConvertToRelativeForMake(
mf->GetHomeDirectory()) root->GetSourceDirectory())
<< " -B" << this->ConvertToRelativeForMake( << " -B" << this->ConvertToRelativeForMake(
mf->GetHomeOutputDirectory()) << "\n"; root->GetBinaryDirectory()) << "\n";
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1033,7 +1034,7 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
this->CurrentLocalGenerator = gen; this->CurrentLocalGenerator = gen;
this->CurrentMakefile = gen->GetMakefile(); this->CurrentMakefile = gen->GetMakefile();
std::string outdir = std::string outdir =
cmSystemTools::CollapseFullPath(this->CurrentMakefile-> cmSystemTools::CollapseFullPath(this->CurrentLocalGenerator->
GetCurrentBinaryDirectory()); GetCurrentBinaryDirectory());
cmSystemTools::SplitPath(outdir.c_str(), cmSystemTools::SplitPath(outdir.c_str(),
this->CurrentOutputDirectoryComponents); this->CurrentOutputDirectoryComponents);
@ -1389,7 +1390,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget)
// linker language. This should convince Xcode to choose the proper // linker language. This should convince Xcode to choose the proper
// language. // language.
cmMakefile* mf = cmtarget.GetMakefile(); cmMakefile* mf = cmtarget.GetMakefile();
std::string fname = mf->GetCurrentBinaryDirectory(); std::string fname = gtgt->GetLocalGenerator()->GetCurrentBinaryDirectory();
fname += cmake::GetCMakeFilesDirectory(); fname += cmake::GetCMakeFilesDirectory();
fname += "/"; fname += "/";
fname += cmtarget.GetName(); fname += cmtarget.GetName();
@ -1618,7 +1619,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
const & commands, const & commands,
const char* name) const char* name)
{ {
std::string dir = this->CurrentMakefile->GetCurrentBinaryDirectory(); std::string dir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
dir += "/CMakeScripts"; dir += "/CMakeScripts";
cmSystemTools::MakeDirectory(dir.c_str()); cmSystemTools::MakeDirectory(dir.c_str());
std::string makefile = dir; std::string makefile = dir;
@ -1639,7 +1640,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
currentConfig->c_str()); currentConfig->c_str());
} }
std::string cdir = this->CurrentMakefile->GetCurrentBinaryDirectory(); std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
cdir = this->ConvertToRelativeForXCode(cdir.c_str()); cdir = this->ConvertToRelativeForXCode(cdir.c_str());
std::string makecmd = "make -C "; std::string makecmd = "make -C ";
makecmd += cdir; makecmd += cdir;
@ -1967,7 +1968,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
} }
// Set attributes to specify the proper name for the target. // Set attributes to specify the proper name for the target.
std::string pndir = this->CurrentMakefile->GetCurrentBinaryDirectory(); std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
if(target.GetType() == cmTarget::STATIC_LIBRARY || if(target.GetType() == cmTarget::STATIC_LIBRARY ||
target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY ||
target.GetType() == cmTarget::MODULE_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY ||
@ -3342,7 +3343,7 @@ bool cmGlobalXCodeGenerator
this->RootObject->SetComment("Project object"); this->RootObject->SetComment("Project object");
std::string project_id = "PROJECT_"; std::string project_id = "PROJECT_";
project_id += root->GetMakefile()->GetProjectName(); project_id += root->GetProjectName();
this->RootObject->SetId(this->GetOrCreateId( this->RootObject->SetId(this->GetOrCreateId(
project_id.c_str(), this->RootObject->GetId()).c_str()); project_id.c_str(), this->RootObject->GetId()).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(""));
@ -3484,7 +3485,7 @@ bool cmGlobalXCodeGenerator
} }
} }
std::string symroot = root->GetMakefile()->GetCurrentBinaryDirectory(); std::string symroot = root->GetCurrentBinaryDirectory();
symroot += "/build"; symroot += "/build";
buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str()));
@ -3727,9 +3728,9 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
{ {
return; return;
} }
std::string xcodeDir = root->GetMakefile()->GetCurrentBinaryDirectory(); std::string xcodeDir = root->GetCurrentBinaryDirectory();
xcodeDir += "/"; xcodeDir += "/";
xcodeDir += root->GetMakefile()->GetProjectName(); xcodeDir += root->GetProjectName();
xcodeDir += ".xcode"; xcodeDir += ".xcode";
if(this->XcodeVersion > 20) if(this->XcodeVersion > 20)
{ {
@ -3749,7 +3750,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
// Since this call may have created new cache entries, save the cache: // Since this call may have created new cache entries, save the cache:
// //
root->GetMakefile()->GetCMakeInstance()->SaveCache( root->GetMakefile()->GetCMakeInstance()->SaveCache(
root->GetMakefile()->GetHomeOutputDirectory()); root->GetBinaryDirectory());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -64,7 +64,7 @@ void cmInstallExportGenerator::ComputeTempDir()
// Choose a temporary directory in which to generate the import // Choose a temporary directory in which to generate the import
// files to be installed. // files to be installed.
this->TempDir = this->TempDir =
this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory(); this->LocalGenerator->GetCurrentBinaryDirectory();
this->TempDir += cmake::GetCMakeFilesDirectory(); this->TempDir += cmake::GetCMakeFilesDirectory();
this->TempDir += "/Export"; this->TempDir += "/Export";
if(this->Destination.empty()) if(this->Destination.empty())

View File

@ -2431,6 +2431,11 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
return 0; return 0;
} }
std::string cmLocalGenerator::GetProjectName() const
{
return this->StateSnapshot.GetProjectName();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
@ -2858,6 +2863,31 @@ cmLocalGenerator
return source.GetLanguage(); return source.GetLanguage();
} }
cmake* cmLocalGenerator::GetCMakeInstance() const
{
return this->GlobalGenerator->GetCMakeInstance();
}
const char* cmLocalGenerator::GetSourceDirectory() const
{
return this->GetCMakeInstance()->GetHomeDirectory();
}
const char* cmLocalGenerator::GetBinaryDirectory() const
{
return this->GetCMakeInstance()->GetHomeOutputDirectory();
}
const char* cmLocalGenerator::GetCurrentBinaryDirectory() const
{
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

View File

@ -182,6 +182,8 @@ public:
const std::string& config, const std::string& config,
const std::string& lang); const std::string& lang);
std::string GetProjectName() const;
/** Compute the language used to compile the given source file. */ /** Compute the language used to compile the given source file. */
std::string GetSourceFileLanguage(const cmSourceFile& source); std::string GetSourceFileLanguage(const cmSourceFile& source);
@ -251,6 +253,14 @@ public:
*/ */
bool NeedBackwardsCompatibility_2_4(); bool NeedBackwardsCompatibility_2_4();
cmake* GetCMakeInstance() const;
const char* GetSourceDirectory() const;
const char* GetBinaryDirectory() 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.
*/ */

View File

@ -183,7 +183,7 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os)
{ {
cmGlobalNinjaGenerator::WriteDivider(os); cmGlobalNinjaGenerator::WriteDivider(os);
os os
<< "# Project: " << this->GetMakefile()->GetProjectName() << std::endl << "# Project: " << this->GetProjectName() << std::endl
<< "# Configuration: " << this->ConfigName << std::endl << "# Configuration: " << this->ConfigName << std::endl
; ;
cmGlobalNinjaGenerator::WriteDivider(os); cmGlobalNinjaGenerator::WriteDivider(os);
@ -363,7 +363,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(
if (ccg.GetNumberOfCommands() > 0) { if (ccg.GetNumberOfCommands() > 0) {
std::string wd = ccg.GetWorkingDirectory(); std::string wd = ccg.GetWorkingDirectory();
if (wd.empty()) if (wd.empty())
wd = this->GetMakefile()->GetCurrentBinaryDirectory(); wd = this->GetCurrentBinaryDirectory();
std::ostringstream cdCmd; std::ostringstream cdCmd;
#ifdef _WIN32 #ifdef _WIN32

View File

@ -399,7 +399,7 @@ cmLocalUnixMakefileGenerator3
); );
} }
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
// Write the rule to the makefile. // Write the rule to the makefile.
@ -449,7 +449,7 @@ void cmLocalUnixMakefileGenerator3
commands.push_back(this->GetRecursiveMakeCall commands.push_back(this->GetRecursiveMakeCall
(makefile2.c_str(),localName)); (makefile2.c_str(),localName));
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "Convenience name for target.", this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
localName, depends, commands, true); localName, depends, commands, true);
@ -478,7 +478,7 @@ void cmLocalUnixMakefileGenerator3
commands.push_back(this->GetRecursiveMakeCall commands.push_back(this->GetRecursiveMakeCall
(makefileName.c_str(), makeTargetName)); (makefileName.c_str(), makeTargetName));
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "fast build rule for target.", this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
localName, depends, commands, true); localName, depends, commands, true);
@ -496,7 +496,7 @@ void cmLocalUnixMakefileGenerator3
commands.push_back(this->GetRecursiveMakeCall commands.push_back(this->GetRecursiveMakeCall
(makefile2.c_str(), makeTargetName)); (makefile2.c_str(), makeTargetName));
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, this->WriteMakeRule(ruleFileStream,
"Manual pre-install relink rule for target.", "Manual pre-install relink rule for target.",
@ -750,13 +750,13 @@ cmLocalUnixMakefileGenerator3
makefileStream makefileStream
<< "# The top-level source directory on which CMake was run.\n" << "# The top-level source directory on which CMake was run.\n"
<< "CMAKE_SOURCE_DIR = " << "CMAKE_SOURCE_DIR = "
<< this->Convert(this->Makefile->GetHomeDirectory(), FULL, SHELL) << this->Convert(this->GetSourceDirectory(), FULL, SHELL)
<< "\n" << "\n"
<< "\n"; << "\n";
makefileStream makefileStream
<< "# The top-level build directory on which CMake was run.\n" << "# The top-level build directory on which CMake was run.\n"
<< "CMAKE_BINARY_DIR = " << "CMAKE_BINARY_DIR = "
<< this->Convert(this->Makefile->GetHomeOutputDirectory(), FULL, SHELL) << this->Convert(this->GetBinaryDirectory(), FULL, SHELL)
<< "\n" << "\n"
<< "\n"; << "\n";
} }
@ -889,7 +889,7 @@ void cmLocalUnixMakefileGenerator3
if(!this->GetMakefile()->IsRootMakefile()) if(!this->GetMakefile()->IsRootMakefile())
{ {
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
} }
this->WriteMakeRule(makefileStream, this->WriteMakeRule(makefileStream,
@ -1838,7 +1838,7 @@ void cmLocalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system"); depends.push_back("cmake_check_build_system");
std::string progressDir = this->Makefile->GetHomeOutputDirectory(); std::string progressDir = this->GetBinaryDirectory();
progressDir += cmake::GetCMakeFilesDirectory(); progressDir += cmake::GetCMakeFilesDirectory();
{ {
std::ostringstream progCmd; std::ostringstream progCmd;
@ -1862,7 +1862,7 @@ void cmLocalUnixMakefileGenerator3
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
recursiveTarget)); recursiveTarget));
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
{ {
std::ostringstream progCmd; std::ostringstream progCmd;
@ -1884,7 +1884,7 @@ void cmLocalUnixMakefileGenerator3
commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
recursiveTarget)); recursiveTarget));
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "The main clean target", "clean", this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
depends, commands, true); depends, commands, true);
@ -1914,7 +1914,7 @@ void cmLocalUnixMakefileGenerator3
commands.push_back commands.push_back
(this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.", this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
"preinstall", depends, commands, true); "preinstall", depends, commands, true);
@ -1935,7 +1935,7 @@ void cmLocalUnixMakefileGenerator3
runRule += " 1"; runRule += " 1";
commands.push_back(runRule); commands.push_back(runRule);
this->CreateCDCommand(commands, this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(), this->GetBinaryDirectory(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "clear depends", this->WriteMakeRule(ruleFileStream, "clear depends",
"depend", "depend",

View File

@ -111,14 +111,14 @@ void cmLocalVisualStudio6Generator::Generate()
void cmLocalVisualStudio6Generator::OutputDSPFile() void cmLocalVisualStudio6Generator::OutputDSPFile()
{ {
// If not an in source build, then create the output directory // If not an in source build, then create the output directory
if(strcmp(this->Makefile->GetCurrentBinaryDirectory(), if(strcmp(this->GetCurrentBinaryDirectory(),
this->Makefile->GetHomeDirectory()) != 0) this->GetSourceDirectory()) != 0)
{ {
if(!cmSystemTools::MakeDirectory if(!cmSystemTools::MakeDirectory
(this->Makefile->GetCurrentBinaryDirectory())) (this->GetCurrentBinaryDirectory()))
{ {
cmSystemTools::Error("Error creating directory ", cmSystemTools::Error("Error creating directory ",
this->Makefile->GetCurrentBinaryDirectory()); this->GetCurrentBinaryDirectory());
} }
} }
@ -163,7 +163,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
std::string::size_type pos = l->first.rfind('/'); std::string::size_type pos = l->first.rfind('/');
if(pos != std::string::npos) if(pos != std::string::npos)
{ {
std::string dir = this->Makefile->GetCurrentBinaryDirectory(); std::string dir = this->GetCurrentBinaryDirectory();
dir += "/"; dir += "/";
dir += l->first.substr(0, pos); dir += l->first.substr(0, pos);
if(!cmSystemTools::MakeDirectory(dir.c_str())) if(!cmSystemTools::MakeDirectory(dir.c_str()))
@ -189,7 +189,7 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname,
// create the dsp.cmake file // create the dsp.cmake file
std::string fname; std::string fname;
fname = this->Makefile->GetCurrentBinaryDirectory(); fname = this->GetCurrentBinaryDirectory();
fname += "/"; fname += "/";
fname += pname; fname += pname;
fname += ".dsp"; fname += ".dsp";
@ -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()))
@ -226,10 +226,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
comment += makefileIn; comment += makefileIn;
std::string args; std::string args;
args = "-H"; args = "-H";
args += this->Makefile->GetHomeDirectory(); args += this->GetSourceDirectory();
commandLine.push_back(args); commandLine.push_back(args);
args = "-B"; args = "-B";
args += this->Makefile->GetHomeOutputDirectory(); args += this->GetBinaryDirectory();
commandLine.push_back(args); commandLine.push_back(args);
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles(); std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();
@ -578,9 +578,9 @@ cmLocalVisualStudio6Generator
const cmCustomCommand& origCommand) const cmCustomCommand& origCommand)
{ {
// Create a fake output that forces the rule to run. // Create a fake output that forces the rule to run.
char* output = new char[(strlen(this->Makefile->GetCurrentBinaryDirectory()) char* output = new char[(strlen(this->GetCurrentBinaryDirectory())
+ target.GetName().size() + 30)]; + target.GetName().size() + 30)];
sprintf(output,"%s/%s_force_%i", this->Makefile->GetCurrentBinaryDirectory(), sprintf(output,"%s/%s_force_%i", this->GetCurrentBinaryDirectory(),
target.GetName().c_str(), count); target.GetName().c_str(), count);
const char* comment = origCommand.GetComment(); const char* comment = origCommand.GetComment();
if(!comment && origCommand.GetOutputs().empty()) if(!comment && origCommand.GetOutputs().empty())
@ -1964,7 +1964,7 @@ cmLocalVisualStudio6Generator
// files directory for any configuration. This is used to construct // files directory for any configuration. This is used to construct
// object file names that do not produce paths that are too long. // object file names that do not produce paths that are too long.
std::string dir_max; std::string dir_max;
dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += this->GetCurrentBinaryDirectory();
dir_max += "/"; dir_max += "/";
dir_max += config_max; dir_max += config_max;
dir_max += "/"; dir_max += "/";

View File

@ -140,7 +140,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
cmCustomCommandLines force_commands; cmCustomCommandLines force_commands;
force_commands.push_back(force_command); force_commands.push_back(force_command);
std::string no_main_dependency = ""; std::string no_main_dependency = "";
std::string force = this->Makefile->GetCurrentBinaryDirectory(); std::string force = this->GetCurrentBinaryDirectory();
force += cmake::GetCMakeFilesDirectory(); force += cmake::GetCMakeFilesDirectory();
force += "/"; force += "/";
force += tgt.GetName(); force += tgt.GetName();
@ -164,14 +164,14 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
void cmLocalVisualStudio7Generator::WriteProjectFiles() void cmLocalVisualStudio7Generator::WriteProjectFiles()
{ {
// If not an in source build, then create the output directory // If not an in source build, then create the output directory
if(strcmp(this->Makefile->GetCurrentBinaryDirectory(), if(strcmp(this->GetCurrentBinaryDirectory(),
this->Makefile->GetHomeDirectory()) != 0) this->GetSourceDirectory()) != 0)
{ {
if(!cmSystemTools::MakeDirectory if(!cmSystemTools::MakeDirectory
(this->Makefile->GetCurrentBinaryDirectory())) (this->GetCurrentBinaryDirectory()))
{ {
cmSystemTools::Error("Error creating directory ", cmSystemTools::Error("Error creating directory ",
this->Makefile->GetCurrentBinaryDirectory()); this->GetCurrentBinaryDirectory());
} }
} }
@ -200,7 +200,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
{ {
// Touch a timestamp file used to determine when the project file is // Touch a timestamp file used to determine when the project file is
// out of date. // out of date.
std::string stampName = this->Makefile->GetCurrentBinaryDirectory(); std::string stampName = this->GetCurrentBinaryDirectory();
stampName += cmake::GetCMakeFilesDirectory(); stampName += cmake::GetCMakeFilesDirectory();
cmSystemTools::MakeDirectory(stampName.c_str()); cmSystemTools::MakeDirectory(stampName.c_str());
stampName += "/"; stampName += "/";
@ -247,7 +247,7 @@ void cmLocalVisualStudio7Generator
target.SetProperty("GENERATOR_FILE_NAME",lname.c_str()); target.SetProperty("GENERATOR_FILE_NAME",lname.c_str());
// create the dsp.cmake file // create the dsp.cmake file
std::string fname; std::string fname;
fname = this->Makefile->GetCurrentBinaryDirectory(); fname = this->GetCurrentBinaryDirectory();
fname += "/"; fname += "/";
fname += lname; fname += lname;
if(this->FortranProject) if(this->FortranProject)
@ -276,13 +276,13 @@ void cmLocalVisualStudio7Generator
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
{ {
std::string stampName = this->Makefile->GetCurrentBinaryDirectory(); std::string stampName = this->GetCurrentBinaryDirectory();
stampName += "/"; stampName += "/";
stampName += cmake::GetCMakeFilesDirectoryPostSlash(); stampName += cmake::GetCMakeFilesDirectoryPostSlash();
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());
@ -294,10 +294,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
comment += makefileIn; comment += makefileIn;
std::string args; std::string args;
args = "-H"; args = "-H";
args += this->Makefile->GetHomeDirectory(); args += this->GetSourceDirectory();
commandLine.push_back(args); commandLine.push_back(args);
args = "-B"; args = "-B";
args += this->Makefile->GetHomeOutputDirectory(); args += this->GetBinaryDirectory();
commandLine.push_back(args); commandLine.push_back(args);
commandLine.push_back("--check-stamp-file"); commandLine.push_back("--check-stamp-file");
std::string stampFilename = this->Convert(stampName.c_str(), FULL, std::string stampFilename = this->Convert(stampName.c_str(), FULL,
@ -1723,7 +1723,7 @@ cmLocalVisualStudio7Generator
// files directory for any configuration. This is used to construct // files directory for any configuration. This is used to construct
// object file names that do not produce paths that are too long. // object file names that do not produce paths that are too long.
std::string dir_max; std::string dir_max;
dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += this->GetCurrentBinaryDirectory();
dir_max += "/"; dir_max += "/";
dir_max += this->GetTargetDirectory(target); dir_max += this->GetTargetDirectory(target);
dir_max += "/"; dir_max += "/";

View File

@ -1526,7 +1526,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
parent->GetProperty("LINK_DIRECTORIES")); parent->GetProperty("LINK_DIRECTORIES"));
// the initial project name // the initial project name
this->SetProjectName(parent->GetProjectName()); this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName());
// Copy include regular expressions. // Copy include regular expressions.
this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression; this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression;
@ -2027,11 +2027,6 @@ void cmMakefile::SetProjectName(std::string const& p)
this->StateSnapshot.SetProjectName(p); this->StateSnapshot.SetProjectName(p);
} }
std::string cmMakefile::GetProjectName() const
{
return this->StateSnapshot.GetProjectName();
}
void cmMakefile::AddGlobalLinkInformation(const std::string& name, void cmMakefile::AddGlobalLinkInformation(const std::string& name,
cmTarget& target) cmTarget& target)
{ {

View File

@ -274,11 +274,6 @@ public:
*/ */
void SetProjectName(std::string const& name); void SetProjectName(std::string const& name);
/**
* Get the name of the project for this build.
*/
std::string GetProjectName() const;
/** Get the configurations to be generated. */ /** Get the configurations to be generated. */
std::string GetConfigurations(std::vector<std::string>& configs, std::string GetConfigurations(std::vector<std::string>& configs,
bool single = true) const; bool single = true) const;

View File

@ -419,7 +419,7 @@ void cmMakefileTargetGenerator
this->WriteObjectBuildFile(obj, lang, source, depends); this->WriteObjectBuildFile(obj, lang, source, depends);
// The object file should be checked for dependency integrity. // The object file should be checked for dependency integrity.
std::string objFullPath = this->Makefile->GetCurrentBinaryDirectory(); std::string objFullPath = this->LocalGenerator->GetCurrentBinaryDirectory();
objFullPath += "/"; objFullPath += "/";
objFullPath += obj; objFullPath += obj;
objFullPath = objFullPath =
@ -642,7 +642,8 @@ cmMakefileTargetGenerator
this->LocalGenerator->ExpandRuleVariables(compileCommand, vars); this->LocalGenerator->ExpandRuleVariables(compileCommand, vars);
std::string workingDirectory = std::string workingDirectory =
this->LocalGenerator->Convert( this->LocalGenerator->Convert(
this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::FULL); this->LocalGenerator->GetCurrentBinaryDirectory(),
cmLocalGenerator::FULL);
compileCommand.replace(compileCommand.find(langFlags), compileCommand.replace(compileCommand.find(langFlags),
langFlags.size(), this->GetFlags(lang)); langFlags.size(), this->GetFlags(lang));
std::string langDefines = std::string("$(") + lang + "_DEFINES)"; std::string langDefines = std::string("$(") + lang + "_DEFINES)";
@ -698,7 +699,7 @@ cmMakefileTargetGenerator
// Change the command working directory to the local build tree. // Change the command working directory to the local build tree.
this->LocalGenerator->CreateCDCommand this->LocalGenerator->CreateCDCommand
(compileCommands, (compileCommands,
this->Makefile->GetCurrentBinaryDirectory(), this->LocalGenerator->GetCurrentBinaryDirectory(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
commands.insert(commands.end(), commands.insert(commands.end(),
compileCommands.begin(), compileCommands.end()); compileCommands.begin(), compileCommands.end());
@ -771,7 +772,7 @@ cmMakefileTargetGenerator
this->LocalGenerator->CreateCDCommand this->LocalGenerator->CreateCDCommand
(preprocessCommands, (preprocessCommands,
this->Makefile->GetCurrentBinaryDirectory(), this->LocalGenerator->GetCurrentBinaryDirectory(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
commands.insert(commands.end(), commands.insert(commands.end(),
preprocessCommands.begin(), preprocessCommands.begin(),
@ -828,7 +829,7 @@ cmMakefileTargetGenerator
this->LocalGenerator->CreateCDCommand this->LocalGenerator->CreateCDCommand
(assemblyCommands, (assemblyCommands,
this->Makefile->GetCurrentBinaryDirectory(), this->LocalGenerator->GetCurrentBinaryDirectory(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
commands.insert(commands.end(), commands.insert(commands.end(),
assemblyCommands.begin(), assemblyCommands.begin(),
@ -929,7 +930,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules()
*this->Target); *this->Target);
this->LocalGenerator->CreateCDCommand this->LocalGenerator->CreateCDCommand
(commands, (commands,
this->Makefile->GetCurrentBinaryDirectory(), this->LocalGenerator->GetCurrentBinaryDirectory(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
// Write the rule. // Write the rule.
@ -1095,7 +1096,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// translation table for the dependency scanning process. // translation table for the dependency scanning process.
depCmd << "cd " depCmd << "cd "
<< (this->LocalGenerator->Convert( << (this->LocalGenerator->Convert(
this->Makefile->GetHomeOutputDirectory(), this->LocalGenerator->GetBinaryDirectory(),
cmLocalGenerator::FULL, cmLocalGenerator::SHELL)) cmLocalGenerator::FULL, cmLocalGenerator::SHELL))
<< " && "; << " && ";
#endif #endif
@ -1110,16 +1111,16 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// the state of our local generator sufficiently for its needs. // the state of our local generator sufficiently for its needs.
depCmd << "$(CMAKE_COMMAND) -E cmake_depends \"" depCmd << "$(CMAKE_COMMAND) -E cmake_depends \""
<< this->GlobalGenerator->GetName() << "\" " << this->GlobalGenerator->GetName() << "\" "
<< this->Convert(this->Makefile->GetHomeDirectory(), << 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->Makefile->GetHomeOutputDirectory(), << this->Convert(this->LocalGenerator->GetBinaryDirectory(),
cmLocalGenerator::FULL, cmLocalGenerator::SHELL) cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
<< " " << " "
<< this->Convert(this->Makefile->GetCurrentBinaryDirectory(), << this->Convert(this->LocalGenerator->GetCurrentBinaryDirectory(),
cmLocalGenerator::FULL, cmLocalGenerator::SHELL) cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
<< " " << " "
<< this->Convert(this->InfoFileNameFull, << this->Convert(this->InfoFileNameFull,
@ -1242,7 +1243,7 @@ void
cmMakefileTargetGenerator cmMakefileTargetGenerator
::MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress& progress) const ::MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress& progress) const
{ {
progress.Dir = this->Makefile->GetHomeOutputDirectory(); progress.Dir = this->LocalGenerator->GetBinaryDirectory();
progress.Dir += cmake::GetCMakeFilesDirectory(); progress.Dir += cmake::GetCMakeFilesDirectory();
std::ostringstream progressArg; std::ostringstream progressArg;
progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")"; progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")";

View File

@ -666,8 +666,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
if (!preLinkCmdLines.empty()) if (!preLinkCmdLines.empty())
{ {
const std::string homeOutDir = localGen.ConvertToOutputFormat( const std::string homeOutDir = localGen.ConvertToOutputFormat(
mf->GetHomeOutputDirectory(), localGen.GetBinaryDirectory(),
cmLocalGenerator::SHELL); cmLocalGenerator::SHELL);
preLinkCmdLines.push_back("cd " + homeOutDir); preLinkCmdLines.push_back("cd " + homeOutDir);
} }

View File

@ -45,9 +45,8 @@ 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)
mf->GetHomeDirectory()) == 0)
return new cmNinjaUtilityTargetGenerator(target); return new cmNinjaUtilityTargetGenerator(target);
// else fallthrough // else fallthrough
} }

View File

@ -103,13 +103,13 @@ void cmNinjaUtilityTargetGenerator::Generate()
command, command,
"$(CMAKE_SOURCE_DIR)", "$(CMAKE_SOURCE_DIR)",
this->GetLocalGenerator()->ConvertToOutputFormat( this->GetLocalGenerator()->ConvertToOutputFormat(
this->GetTarget()->GetMakefile()->GetHomeDirectory(), this->GetLocalGenerator()->GetSourceDirectory(),
cmLocalGenerator::SHELL).c_str()); cmLocalGenerator::SHELL).c_str());
cmSystemTools::ReplaceString( cmSystemTools::ReplaceString(
command, command,
"$(CMAKE_BINARY_DIR)", "$(CMAKE_BINARY_DIR)",
this->GetLocalGenerator()->ConvertToOutputFormat( this->GetLocalGenerator()->ConvertToOutputFormat(
this->GetTarget()->GetMakefile()->GetHomeOutputDirectory(), this->GetLocalGenerator()->GetBinaryDirectory(),
cmLocalGenerator::SHELL).c_str()); cmLocalGenerator::SHELL).c_str());
cmSystemTools::ReplaceString(command, "$(ARGS)", ""); cmSystemTools::ReplaceString(command, "$(ARGS)", "");

View File

@ -195,7 +195,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->BuildFileStream = 0; this->BuildFileStream = 0;
this->IsMissingFiles = false; this->IsMissingFiles = false;
this->DefaultArtifactDir = this->DefaultArtifactDir =
this->Makefile->GetCurrentBinaryDirectory() + std::string("/") + this->LocalGenerator->GetCurrentBinaryDirectory() + std::string("/") +
this->LocalGenerator->GetTargetDirectory(*this->Target); this->LocalGenerator->GetTargetDirectory(*this->Target);
} }
@ -297,8 +297,7 @@ void cmVisualStudio10TargetGenerator::Generate()
return; return;
} }
} }
cmMakefile* mf = this->Target->GetMakefile(); std::string path = this->LocalGenerator->GetCurrentBinaryDirectory();
std::string path = mf->GetCurrentBinaryDirectory();
path += "/"; path += "/";
path += this->Name; path += this->Name;
path += ".vcxproj"; path += ".vcxproj";
@ -951,7 +950,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path,
{ {
return forceRelative return forceRelative
? cmSystemTools::RelativePath( ? cmSystemTools::RelativePath(
this->Makefile->GetCurrentBinaryDirectory(), path.c_str()) this->LocalGenerator->GetCurrentBinaryDirectory(), path.c_str())
: path.c_str(); : path.c_str();
} }
@ -990,7 +989,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
this->AddMissingSourceGroups(groupsUsed, sourceGroups); this->AddMissingSourceGroups(groupsUsed, sourceGroups);
// Write out group file // Write out group file
std::string path = this->Makefile->GetCurrentBinaryDirectory(); std::string path = this->LocalGenerator->GetCurrentBinaryDirectory();
path += "/"; path += "/";
path += this->Name; path += this->Name;
path += ".vcxproj.filters"; path += ".vcxproj.filters";
@ -1448,7 +1447,7 @@ void cmVisualStudio10TargetGenerator::WriteSource(
std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true); std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true);
size_t const maxLen = 250; size_t const maxLen = 250;
if(sf->GetCustomCommand() || if(sf->GetCustomCommand() ||
((strlen(this->Makefile->GetCurrentBinaryDirectory()) + 1 + ((strlen(this->LocalGenerator->GetCurrentBinaryDirectory()) + 1 +
sourceRel.length()) <= maxLen)) sourceRel.length()) <= maxLen))
{ {
forceRelative = true; forceRelative = true;
@ -2244,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, "");
@ -3313,7 +3312,8 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
// For WP80, the manifest needs to be in the same folder as the project // For WP80, the manifest needs to be in the same folder as the project
// this can cause an overwrite problem if projects aren't organized in // this can cause an overwrite problem if projects aren't organized in
// folders // folders
std::string manifestFile = this->Makefile->GetCurrentBinaryDirectory() + std::string manifestFile =
this->LocalGenerator->GetCurrentBinaryDirectory() +
std::string("/WMAppManifest.xml"); std::string("/WMAppManifest.xml");
std::string artifactDir = std::string artifactDir =
this->LocalGenerator->GetTargetDirectory(*this->Target); this->LocalGenerator->GetTargetDirectory(*this->Target);