cmLocalGenerator: Add current binary directory accessor.

This commit is contained in:
Stephen Kelly 2015-09-25 00:13:20 +02:00
parent 12cb3bdce4
commit bbef3c2da8
18 changed files with 80 additions and 77 deletions

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

@ -76,8 +76,7 @@ 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=lgs[0]->GetProjectName();
std::string filename=outputDir+"/"; std::string filename=outputDir+"/";
@ -331,7 +330,7 @@ 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(),
(*lg)->GetBinaryDirectory())==0) (*lg)->GetBinaryDirectory())==0)
{ {
this->AppendTarget(fout, ti->first, 0, this->AppendTarget(fout, ti->first, 0,
@ -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(),
it->second[0]->GetBinaryDirectory()) == 0) it->second[0]->GetBinaryDirectory()) == 0)
{ {
workspaceOutputDir = mf->GetCurrentBinaryDirectory(); workspaceOutputDir = it->second[0]->GetCurrentBinaryDirectory();
workspaceProjectName = it->second[0]->GetProjectName(); workspaceProjectName = it->second[0]->GetProjectName();
workspaceSourcePath = it->second[0]->GetSourceDirectory(); 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,8 +91,7 @@ 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 = it->second[0]->GetProjectName();
std::string filename = outputDir + "/" + projectName + ".project"; std::string filename = outputDir + "/" + projectName + ".project";
@ -121,8 +120,7 @@ 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 = lgs[0]->GetProjectName();
std::string filename = outputDir + "/"; std::string filename = outputDir + "/";

View File

@ -208,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
@ -1036,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 == ".")
{ {
@ -1098,7 +1097,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
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 \"";

View File

@ -121,7 +121,7 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
{ {
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 == (*it)->GetBinaryDirectory()); 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)

View File

@ -77,8 +77,7 @@ 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=lgs[0]->GetProjectName();
const std::string filename = const std::string filename =

View File

@ -49,8 +49,7 @@ 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=it->second[0]->GetSourceDirectory();
std::string projectName=it->second[0]->GetProjectName(); std::string projectName=it->second[0]->GetProjectName();
std::string cmakeFilePattern("CMakeLists.txt;*.cmake;"); std::string cmakeFilePattern("CMakeLists.txt;*.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;
@ -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);

View File

@ -363,7 +363,7 @@ void cmGlobalVisualStudio7Generator
return; return;
} }
this->CurrentProject = root->GetProjectName(); this->CurrentProject = root->GetProjectName();
std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory(); std::string fname = root->GetCurrentBinaryDirectory();
fname += "/"; fname += "/";
fname += root->GetProjectName(); fname += root->GetProjectName();
fname += ".sln"; fname += ".sln";
@ -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

@ -414,11 +414,12 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
this->SetCurrentLocalGenerator(root); this->SetCurrentLocalGenerator(root);
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(), cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(),
this->ProjectSourceDirectoryComponents); this->ProjectSourceDirectoryComponents);
cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentBinaryDirectory(), cmSystemTools::SplitPath(
this->ProjectOutputDirectoryComponents); 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";
@ -466,7 +467,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
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)
{ {
@ -568,7 +569,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 +582,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";
@ -1033,7 +1033,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 +1389,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 +1618,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 +1639,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 +1967,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 ||
@ -3484,7 +3484,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,7 +3727,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
{ {
return; return;
} }
std::string xcodeDir = root->GetMakefile()->GetCurrentBinaryDirectory(); std::string xcodeDir = root->GetCurrentBinaryDirectory();
xcodeDir += "/"; xcodeDir += "/";
xcodeDir += root->GetProjectName(); xcodeDir += root->GetProjectName();
xcodeDir += ".xcode"; xcodeDir += ".xcode";

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

@ -2878,6 +2878,11 @@ const char* cmLocalGenerator::GetBinaryDirectory() const
return this->GetCMakeInstance()->GetHomeOutputDirectory(); return this->GetCMakeInstance()->GetHomeOutputDirectory();
} }
const char* cmLocalGenerator::GetCurrentBinaryDirectory() const
{
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
std::string std::string
cmLocalGenerator::GetTargetDirectory(cmTarget const&) const cmLocalGenerator::GetTargetDirectory(cmTarget const&) const

View File

@ -258,6 +258,8 @@ public:
const char* GetSourceDirectory() const; const char* GetSourceDirectory() const;
const char* GetBinaryDirectory() const; const char* GetBinaryDirectory() const;
const char* GetCurrentBinaryDirectory() const;
/** /**
* Generate a Mac OS X application bundle Info.plist file. * Generate a Mac OS X application bundle Info.plist file.
*/ */

View File

@ -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

@ -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->GetSourceDirectory()) != 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";
@ -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->GetSourceDirectory()) != 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,7 +276,7 @@ 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";
@ -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

@ -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.
@ -1119,7 +1120,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< this->Convert(this->LocalGenerator->GetBinaryDirectory(), << 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,

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;
@ -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);