diff options
author | Brad King <brad.king@kitware.com> | 2015-04-21 13:42:07 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-21 13:42:07 (GMT) |
commit | 5a5ef00106662da5c6400d76438289f505b4a1ff (patch) | |
tree | fc3dcb6d19a8d1d9bc28a1f60338551c3a4e510c /Source | |
parent | 81c01d4a3461cf645ff3db794cf6217318f268d3 (diff) | |
parent | 8dc3a67c9c3c5b49fe7a3b69dab7d60475414c59 (diff) | |
download | CMake-5a5ef00106662da5c6400d76438289f505b4a1ff.zip CMake-5a5ef00106662da5c6400d76438289f505b4a1ff.tar.gz CMake-5a5ef00106662da5c6400d76438289f505b4a1ff.tar.bz2 |
Merge topic 'clean-up-cmMakefile'
8dc3a67c cmMakefile: Out-of-line the directory methods.
0f3c8cfa cmMakefile: Use method abstraction to access directories.
b288a997 cmMakefile: Rename SetStart* directory API to SetCurrent*.
932d53bc cmMakefile: Remove redundant method duplication.
32b8f03a cmMakefile: Port users of GetStart* methods to new names.
54d6a918 cmMakefile: Rename GetCurrent{Output,Binary}Directory.
55d80d0a cmMakefile: Rename GetCurrent{,Source}Directory.
b23cf06f cmake: Remove redundant start directories.
fcf246ac cmMakefile: Populate Home directories on initialize.
8878bea7 cmake: Initialize Home directories on cmake for find-package mode.
044dc815 Use the Home directories from the cmake class where intended.
d67e8f24 cmake: Fix directory used to find the cache
1ea085d1 cmMakefile: Initialize dir definitions early.
f034bb2f Remove redundant calls to MakeStartDirectoriesCurrent.
3a68c323 cmMakefile: Fix wrong parameter names.
Diffstat (limited to 'Source')
74 files changed, 360 insertions, 434 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index d1e7e3a..0a34be8 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -346,10 +346,10 @@ void cmCTestScriptHandler::CreateCMake() this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest); // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. - // Also, some commands need Makefile->GetCurrentDirectory(). + // Also, some commands need Makefile->GetCurrentSourceDirectory(). std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->Makefile->SetStartDirectory(cwd); - this->Makefile->SetStartOutputDirectory(cwd); + this->Makefile->SetCurrentSourceDirectory(cwd); + this->Makefile->SetCurrentBinaryDirectory(cwd); // remove all cmake commands which are not scriptable, since they can't be // used in ctest scripts diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 6524350..9edbb20 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -144,9 +144,7 @@ void QCMake::configure() #endif this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toLocal8Bit().data()); - this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toLocal8Bit().data()); this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toLocal8Bit().data()); - this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toLocal8Bit().data()); this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data())); this->CMakeInstance->SetGeneratorPlatform(""); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 8fb49ca..ba9e663 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -168,7 +168,7 @@ bool cmAddCustomCommandCommand // and later references "${CMAKE_CURRENT_SOURCE_DIR}/out.txt". // This is fairly obscure so we can wait for someone to // complain. - filename = this->Makefile->GetCurrentOutputDirectory(); + filename = this->Makefile->GetCurrentBinaryDirectory(); filename += "/"; } filename += copy; @@ -315,7 +315,7 @@ bool cmAddCustomCommandCommand // Convert working directory to a full path. if(!working.empty()) { - const char* build_dir = this->Makefile->GetCurrentOutputDirectory(); + const char* build_dir = this->Makefile->GetCurrentBinaryDirectory(); working = cmSystemTools::CollapseFullPath(working, build_dir); } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index a0e20c8..c246aee 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -138,7 +138,7 @@ bool cmAddCustomTargetCommand std::string filename; if (!cmSystemTools::FileIsFullPath(copy.c_str())) { - filename = this->Makefile->GetCurrentOutputDirectory(); + filename = this->Makefile->GetCurrentBinaryDirectory(); filename += "/"; } filename += copy; @@ -240,7 +240,7 @@ bool cmAddCustomTargetCommand // Convert working directory to a full path. if(!working_directory.empty()) { - const char* build_dir = this->Makefile->GetCurrentOutputDirectory(); + const char* build_dir = this->Makefile->GetCurrentBinaryDirectory(); working_directory = cmSystemTools::CollapseFullPath(working_directory, build_dir); } diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 9d55c1a..69c6a14 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -57,7 +57,7 @@ bool cmAddSubDirectoryCommand::InitialPass } else { - srcPath = this->Makefile->GetCurrentDirectory(); + srcPath = this->Makefile->GetCurrentSourceDirectory(); srcPath += "/"; srcPath += srcArg; } @@ -79,12 +79,12 @@ bool cmAddSubDirectoryCommand::InitialPass // not a subdirectory of the current directory then it is an // error. if(!cmSystemTools::IsSubDirectory(srcPath, - this->Makefile->GetCurrentDirectory())) + this->Makefile->GetCurrentSourceDirectory())) { std::ostringstream e; e << "not given a binary directory but the given source directory " << "\"" << srcPath << "\" is not a subdirectory of \"" - << this->Makefile->GetCurrentDirectory() << "\". " + << this->Makefile->GetCurrentSourceDirectory() << "\". " << "When specifying an out-of-tree source a binary directory " << "must be explicitly specified."; this->SetError(e.str()); @@ -93,8 +93,8 @@ bool cmAddSubDirectoryCommand::InitialPass // Remove the CurrentDirectory from the srcPath and replace it // with the CurrentOutputDirectory. - const char* src = this->Makefile->GetCurrentDirectory(); - const char* bin = this->Makefile->GetCurrentOutputDirectory(); + const char* src = this->Makefile->GetCurrentSourceDirectory(); + const char* bin = this->Makefile->GetCurrentBinaryDirectory(); size_t srcLen = strlen(src); size_t binLen = strlen(bin); if(srcLen > 0 && src[srcLen-1] == '/') @@ -113,7 +113,7 @@ bool cmAddSubDirectoryCommand::InitialPass } else { - binPath = this->Makefile->GetCurrentOutputDirectory(); + binPath = this->Makefile->GetCurrentBinaryDirectory(); binPath += "/"; binPath += binArg; } diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index b8238f8..5f5017d 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -29,7 +29,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass std::string tdir; if(!cmSystemTools::FileIsFullPath(templateDirectory.c_str())) { - tdir = this->Makefile->GetCurrentDirectory(); + tdir = this->Makefile->GetCurrentSourceDirectory(); tdir += "/"; tdir += templateDirectory; } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 77cd6c6..c55ea35 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -131,22 +131,22 @@ const char* CCONV cmGetHomeOutputDirectory(void *arg) const char* CCONV cmGetStartDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); - return mf->GetStartDirectory(); + return mf->GetCurrentSourceDirectory(); } const char* CCONV cmGetStartOutputDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); - return mf->GetStartOutputDirectory(); + return mf->GetCurrentBinaryDirectory(); } const char* CCONV cmGetCurrentDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); - return mf->GetCurrentDirectory(); + return mf->GetCurrentSourceDirectory(); } const char* CCONV cmGetCurrentOutputDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); - return mf->GetCurrentOutputDirectory(); + return mf->GetCurrentBinaryDirectory(); } const char* CCONV cmGetDefinition(void *arg,const char*def) { diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index 6876388..46b71c5 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -26,7 +26,7 @@ bool cmConfigureFileCommand const char* inFile = args[0].c_str(); if(!cmSystemTools::FileIsFullPath(inFile)) { - this->InputFile = this->Makefile->GetCurrentDirectory(); + this->InputFile = this->Makefile->GetCurrentSourceDirectory(); this->InputFile += "/"; } this->InputFile += inFile; @@ -45,7 +45,7 @@ bool cmConfigureFileCommand const char* outFile = args[1].c_str(); if(!cmSystemTools::FileIsFullPath(outFile)) { - this->OutputFile = this->Makefile->GetCurrentOutputDirectory(); + this->OutputFile = this->Makefile->GetCurrentBinaryDirectory(); this->OutputFile += "/"; } this->OutputFile += outFile; diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index f93d3df..54c27d6 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -73,7 +73,7 @@ bool cmCreateTestSourceList "You must specify a file extension for the test driver file."); return false; } - std::string driver = this->Makefile->GetCurrentOutputDirectory(); + std::string driver = this->Makefile->GetCurrentBinaryDirectory(); driver += "/"; driver += *i; ++i; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index d9818ce..f12116e 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -237,7 +237,7 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, else { mod_dir = - this->LocalGenerator->GetMakefile()->GetCurrentOutputDirectory(); + this->LocalGenerator->GetMakefile()->GetCurrentBinaryDirectory(); } // Actually write dependencies to the streams. diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 76283d4..06541c0 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -113,7 +113,7 @@ bool cmExportCommand else { // Interpret relative paths with respect to the current build dir. - std::string dir = this->Makefile->GetCurrentOutputDirectory(); + std::string dir = this->Makefile->GetCurrentBinaryDirectory(); fname = dir + "/" + fname; } @@ -295,7 +295,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args) // We store the current build directory in the registry as a value // named by a hash of its own content. This is deterministic and is // unique with high probability. - const char* outDir = this->Makefile->GetCurrentOutputDirectory(); + const char* outDir = this->Makefile->GetCurrentBinaryDirectory(); std::string hash = cmSystemTools::ComputeStringMD5(outDir); #if defined(_WIN32) && !defined(__CYGWIN__) this->StorePackageRegistryWin(package, outDir, hash.c_str()); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 554b686..e374387 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -77,7 +77,7 @@ void cmExtraCodeBlocksGenerator::CreateProjectFile( const std::vector<cmLocalGenerator*>& lgs) { const cmMakefile* mf=lgs[0]->GetMakefile(); - std::string outputDir=mf->GetStartOutputDirectory(); + std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectName=mf->GetProjectName(); std::string filename=outputDir+"/"; @@ -331,7 +331,7 @@ void cmExtraCodeBlocksGenerator { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs - if (strcmp(makefile->GetStartOutputDirectory(), + if (strcmp(makefile->GetCurrentBinaryDirectory(), makefile->GetHomeOutputDirectory())==0) { this->AppendTarget(fout, ti->first, 0, @@ -524,7 +524,7 @@ std::string cmExtraCodeBlocksGenerator::CreateDummyTargetFile( // 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 // C::B uses it in some way, the targets don't interfere with each other. - std::string filename = mf->GetCurrentOutputDirectory(); + std::string filename = mf->GetCurrentBinaryDirectory(); filename += "/"; filename += mf->GetLocalGenerator()->GetTargetDirectory(*target); filename += "/"; @@ -550,14 +550,14 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, const cmMakefile* makefile, const char* compiler) { - std::string makefileName = makefile->GetStartOutputDirectory(); + std::string makefileName = makefile->GetCurrentBinaryDirectory(); makefileName += "/Makefile"; fout<<" <Target title=\"" << targetName << "\">\n"; if (target!=0) { int cbTargetType = this->GetCBTargetType(target); - std::string workingDir = makefile->GetStartOutputDirectory(); + std::string workingDir = makefile->GetCurrentBinaryDirectory(); if ( target->GetType()==cmTarget::EXECUTABLE) { // Determine the directory where the executable target is created, and @@ -653,7 +653,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, else // e.g. all and the GLOBAL and UTILITY targets { fout<<" <Option working_dir=\"" - << makefile->GetStartOutputDirectory() << "\" />\n" + << makefile->GetCurrentBinaryDirectory() << "\" />\n" <<" <Option type=\"" << 4 << "\" />\n"; } diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index eb50a7d..9705d2b 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -68,15 +68,15 @@ void cmExtraCodeLiteGenerator::Generate() const cmMakefile* mf =it->second[0]->GetMakefile(); this->ConfigName = GetConfigurationName( mf ); - if (strcmp(mf->GetStartOutputDirectory(), + if (strcmp(mf->GetCurrentBinaryDirectory(), mf->GetHomeOutputDirectory()) == 0) { - workspaceOutputDir = mf->GetStartOutputDirectory(); + workspaceOutputDir = mf->GetCurrentBinaryDirectory(); workspaceProjectName = mf->GetProjectName(); workspaceSourcePath = mf->GetHomeDirectory(); workspaceFileName = workspaceOutputDir+"/"; workspaceFileName += workspaceProjectName + ".workspace"; - this->WorkspacePath = mf->GetStartOutputDirectory();; + this->WorkspacePath = mf->GetCurrentBinaryDirectory();; fout.Open(workspaceFileName.c_str(), false, false); fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" @@ -92,7 +92,7 @@ void cmExtraCodeLiteGenerator::Generate() { // retrive project information const cmMakefile* mf = it->second[0]->GetMakefile(); - std::string outputDir = mf->GetStartOutputDirectory(); + std::string outputDir = mf->GetCurrentBinaryDirectory(); std::string projectName = mf->GetProjectName(); std::string filename = outputDir + "/" + projectName + ".project"; @@ -122,7 +122,7 @@ void cmExtraCodeLiteGenerator::CreateProjectFile( const std::vector<cmLocalGenerator*>& lgs) { const cmMakefile* mf = lgs[0]->GetMakefile(); - std::string outputDir = mf->GetStartOutputDirectory(); + std::string outputDir = mf->GetCurrentBinaryDirectory(); std::string projectName = mf->GetProjectName(); std::string filename = outputDir + "/"; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 24043af..72a6a30 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -495,7 +495,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() std::string sourceLinkedResourceName = "[Source directory]"; std::string linkSourceDirectory = this->GetEclipsePath( - mf->GetStartDirectory()); + mf->GetCurrentSourceDirectory()); // .project dir can't be subdir of a linked resource dir if (!cmSystemTools::IsSubDirectory(this->HomeOutputDirectory, linkSourceDirectory)) @@ -633,7 +633,7 @@ void cmExtraEclipseCDT4Generator::CreateLinksToSubprojects( ++it) { std::string linkSourceDirectory = this->GetEclipsePath( - it->second[0]->GetMakefile()->GetStartDirectory()); + it->second[0]->GetMakefile()->GetCurrentSourceDirectory()); // a linked resource must not point to a parent directory of .project or // .project itself if ((baseDir != linkSourceDirectory) && @@ -1033,7 +1033,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const { const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); cmMakefile* makefile=(*it)->GetMakefile(); - std::string subdir = (*it)->Convert(makefile->GetCurrentOutputDirectory(), + std::string subdir = (*it)->Convert(makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); if (subdir == ".") { @@ -1094,7 +1094,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const ti->first.c_str()); std::string cleanArgs = "-E chdir \""; - cleanArgs += makefile->GetCurrentOutputDirectory(); + cleanArgs += makefile->GetCurrentBinaryDirectory(); cleanArgs += "\" \""; cleanArgs += cmake; cleanArgs += "\" -P \""; diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 9645d0e..ec141a9 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -123,7 +123,7 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, { const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); cmMakefile* makefile=(*it)->GetMakefile(); - std::string currentDir = makefile->GetCurrentOutputDirectory(); + std::string currentDir = makefile->GetCurrentBinaryDirectory(); bool topLevel = (currentDir == makefile->GetHomeOutputDirectory()); for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) diff --git a/Source/cmExtraQbsGenerator.cxx b/Source/cmExtraQbsGenerator.cxx index 5a1f9ef..4cc4650 100644 --- a/Source/cmExtraQbsGenerator.cxx +++ b/Source/cmExtraQbsGenerator.cxx @@ -41,7 +41,7 @@ void cmExtraQbsGenerator::CreateProjectFile( const std::vector<cmLocalGenerator *> &lgs) { const cmMakefile *mf = lgs[0]->GetMakefile(); - std::string outputDir = mf->GetStartOutputDirectory(); + std::string outputDir = mf->GetCurrentBinaryDirectory(); const std::string filename = outputDir + "/" + name + ".qbs"; @@ -81,7 +81,7 @@ void cmExtraQbsGenerator::AppendSubProject(cmGeneratedFileStream &fout, } const std::string &relativePath = cmSystemTools::RelativePath( - mk->GetHomeDirectory(), mk->GetCurrentDirectory()); + mk->GetHomeDirectory(), mk->GetCurrentSourceDirectory()); fout << "\tProject {\n" << "\t\tname:\"" << relativePath << "\"\n"; this->AppendProduct(fout, lg); diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 25f9005..4e721d4 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -79,7 +79,7 @@ void cmExtraSublimeTextGenerator::CreateProjectFile( const std::vector<cmLocalGenerator*>& lgs) { const cmMakefile* mf=lgs[0]->GetMakefile(); - std::string outputDir=mf->GetStartOutputDirectory(); + std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectName=mf->GetProjectName(); const std::string filename = @@ -174,7 +174,7 @@ void cmExtraSublimeTextGenerator:: { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs - if (strcmp(makefile->GetStartOutputDirectory(), + if (strcmp(makefile->GetCurrentBinaryDirectory(), makefile->GetHomeOutputDirectory())==0) { this->AppendTarget(fout, ti->first, *lg, 0, diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 488beaa..12adfd9 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -24,7 +24,7 @@ bool cmFLTKWrapUICommand } // what is the current source dir - std::string cdir = this->Makefile->GetCurrentDirectory(); + std::string cdir = this->Makefile->GetCurrentSourceDirectory(); const char* fluid_exe = this->Makefile->GetRequiredDefinition("FLTK_FLUID_EXECUTABLE"); @@ -32,7 +32,7 @@ bool cmFLTKWrapUICommand this->Target = args[0]; // Target that will use the generated files // get the list of GUI files from which .cxx and .h will be generated - std::string outputDirectory = this->Makefile->GetCurrentOutputDirectory(); + std::string outputDirectory = this->Makefile->GetCurrentBinaryDirectory(); { // Some of the generated files are *.h so the directory "GUI" @@ -124,7 +124,7 @@ void cmFLTKWrapUICommand::FinalPass() "FLTK_WRAP_UI was called with a target that was never created: "; msg += this->Target; msg +=". The problem was found while processing the source directory: "; - msg += this->Makefile->GetStartDirectory(); + msg += this->Makefile->GetCurrentSourceDirectory(); msg += ". This FLTK_WRAP_UI call will be ignored."; cmSystemTools::Message(msg.c_str(),"Warning"); return; @@ -156,7 +156,7 @@ void cmFLTKWrapUICommand::FinalPass() "for you as was done in CMake 2.0 and earlier. In the future this may " "become an error."; msg +="The problem was found while processing the source directory: "; - msg += this->Makefile->GetStartDirectory(); + msg += this->Makefile->GetCurrentSourceDirectory(); cmSystemTools::Message(msg.c_str(),"Warning"); // first we add the rules for all the .fl to .h and .cxx files size_t lastHeadersClass = this->GeneratedSourcesClasses.size(); diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 6ac0def..14f397c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -227,7 +227,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, std::string fileName = *i; if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + *i; } @@ -309,7 +309,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) std::string fileName = fileNameArg.GetString(); if ( !cmsys::SystemTools::FileIsFullPath(fileName.c_str()) ) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + fileNameArg.GetString(); } @@ -445,7 +445,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) std::string fileName = args[1]; if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + args[1]; } @@ -645,7 +645,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) if (hex_conversion_enabled) { // TODO: should work without temp file, but just on a memory buffer - std::string binaryFileName = this->Makefile->GetCurrentOutputDirectory(); + std::string binaryFileName = this->Makefile->GetCurrentBinaryDirectory(); binaryFileName += cmake::GetCMakeFilesDirectory(); binaryFileName += "/FileCommandStringsBinaryFile"; if(cmHexFileConverter::TryConvert(fileName.c_str(),binaryFileName.c_str())) @@ -984,7 +984,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, cmsys::Glob::GlobMessages globMessages; if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { - std::string expr = this->Makefile->GetCurrentDirectory(); + std::string expr = this->Makefile->GetCurrentSourceDirectory(); // Handle script mode if (!expr.empty()) { @@ -1091,7 +1091,7 @@ bool cmFileCommand::HandleMakeDirectoryCommand( const std::string* cdir = &(*i); if ( !cmsys::SystemTools::FileIsFullPath(i->c_str()) ) { - expr = this->Makefile->GetCurrentDirectory(); + expr = this->Makefile->GetCurrentSourceDirectory(); expr += "/" + *i; cdir = &expr; } @@ -1556,7 +1556,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) } else { - std::string file = this->Makefile->GetCurrentDirectory(); + std::string file = this->Makefile->GetCurrentSourceDirectory(); file += "/" + arg; this->Files.push_back(file); } @@ -1568,7 +1568,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) } else { - this->Destination = this->Makefile->GetCurrentOutputDirectory(); + this->Destination = this->Makefile->GetCurrentBinaryDirectory(); this->Destination += "/" + arg; } this->Doing = DoingNone; @@ -2658,13 +2658,13 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args) std::string oldname = args[1]; if(!cmsys::SystemTools::FileIsFullPath(oldname.c_str())) { - oldname = this->Makefile->GetCurrentDirectory(); + oldname = this->Makefile->GetCurrentSourceDirectory(); oldname += "/" + args[1]; } std::string newname = args[2]; if(!cmsys::SystemTools::FileIsFullPath(newname.c_str())) { - newname = this->Makefile->GetCurrentDirectory(); + newname = this->Makefile->GetCurrentSourceDirectory(); newname += "/" + args[2]; } @@ -2698,7 +2698,7 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args, std::string fileName = *i; if(!cmsys::SystemTools::FileIsFullPath(fileName.c_str())) { - fileName = this->Makefile->GetCurrentDirectory(); + fileName = this->Makefile->GetCurrentSourceDirectory(); fileName += "/" + *i; } @@ -3743,7 +3743,7 @@ bool cmFileCommand::HandleLockCommand( if (!cmsys::SystemTools::FileIsFullPath(path)) { - path = this->Makefile->GetCurrentDirectory() + ("/" + path); + path = this->Makefile->GetCurrentSourceDirectory() + ("/" + path); } // Unify path (remove '//', '/../', ...) diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index aecd230..4d568e9 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -663,7 +663,7 @@ bool cmFindPackageCommand::HandlePackageMode() if(!cmSystemTools::FileIsFullPath(dir.c_str())) { dir = "/" + dir; - dir = this->Makefile->GetCurrentDirectory() + dir; + dir = this->Makefile->GetCurrentSourceDirectory() + dir; } // The file location was cached. Look for the correct file. std::string file; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 41d12d7..1a4f9c4 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1099,8 +1099,8 @@ bool cmStrictTargetComparison::operator()(cmTarget const* t1, int nameResult = strcmp(t1->GetName().c_str(), t2->GetName().c_str()); if (nameResult == 0) { - return strcmp(t1->GetMakefile()->GetStartOutputDirectory(), - t2->GetMakefile()->GetStartOutputDirectory()) < 0; + return strcmp(t1->GetMakefile()->GetCurrentBinaryDirectory(), + t2->GetMakefile()->GetCurrentBinaryDirectory()) < 0; } return nameResult < 0; } diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 8fb2fa1..881b2ae 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -43,7 +43,7 @@ bool cmGetDirectoryPropertyCommand // make sure the start dir is a full path if (!cmSystemTools::FileIsFullPath(sd.c_str())) { - sd = this->Makefile->GetStartDirectory(); + sd = this->Makefile->GetCurrentSourceDirectory(); sd += "/"; sd += *i; } diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 6947a7f..67f9f2d 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -97,7 +97,7 @@ bool cmGetFilenameComponentCommand // If the path given is relative evaluate it relative to the // current source directory. result = cmSystemTools::CollapseFullPath( - filename, this->Makefile->GetCurrentDirectory()); + filename, this->Makefile->GetCurrentSourceDirectory()); if(args[2] == "REALPATH") { // Resolve symlinks if possible diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 3e1d08e..00dbdd3 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -255,7 +255,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() std::string dir = this->Name; if(!cmSystemTools::FileIsFullPath(dir.c_str())) { - dir = this->Makefile->GetCurrentDirectory(); + dir = this->Makefile->GetCurrentSourceDirectory(); dir += "/"; dir += this->Name; } diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 6c20952..e557619 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -29,7 +29,7 @@ void cmGlobalBorlandMakefileGenerator cmMakefile *mf, bool optional) { - std::string outdir = this->CMakeInstance->GetStartOutputDirectory(); + std::string outdir = this->CMakeInstance->GetHomeOutputDirectory(); mf->AddDefinition("BORLAND", "1"); mf->AddDefinition("CMAKE_GENERATOR_CC", "bcc32"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "bcc32"); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4b0ef58..774b172 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1098,14 +1098,13 @@ void cmGlobalGenerator::Configure() this->LocalGenerators.push_back(lg); // set the Start directories - cmMakefile* mf = lg->GetMakefile(); - lg->GetMakefile()->SetStartDirectory - (this->CMakeInstance->GetStartDirectory()); - lg->GetMakefile()->SetStartOutputDirectory - (this->CMakeInstance->GetStartOutputDirectory()); - lg->GetMakefile()->MakeStartDirectoriesCurrent(); + lg->GetMakefile()->SetCurrentSourceDirectory + (this->CMakeInstance->GetHomeDirectory()); + lg->GetMakefile()->SetCurrentBinaryDirectory + (this->CMakeInstance->GetHomeOutputDirectory()); - this->BinaryDirectories.insert(mf->GetStartOutputDirectory()); + this->BinaryDirectories.insert( + this->CMakeInstance->GetHomeOutputDirectory()); // now do it lg->Configure(); @@ -1568,7 +1567,8 @@ void cmGlobalGenerator::CheckLocalGenerators() text += "\n linked by target \""; text += l->second.GetName(); text += "\" in directory "; - text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory(); + text+=this->LocalGenerators[i]->GetMakefile() + ->GetCurrentSourceDirectory(); notFoundMap[varName] = text; } } @@ -1598,7 +1598,7 @@ void cmGlobalGenerator::CheckLocalGenerators() std::string text = notFoundMap[varName]; text += "\n used as include directory in directory "; text += this->LocalGenerators[i] - ->GetMakefile()->GetCurrentDirectory(); + ->GetMakefile()->GetCurrentSourceDirectory(); notFoundMap[varName] = text; } } @@ -2046,7 +2046,7 @@ cmGlobalGenerator::FindLocalGenerator(const std::string& start_dir) const for(std::vector<cmLocalGenerator*>::const_iterator it = this->LocalGenerators.begin(); it != this->LocalGenerators.end(); ++it) { - std::string sd = (*it)->GetMakefile()->GetStartDirectory(); + std::string sd = (*it)->GetMakefile()->GetCurrentSourceDirectory(); if (sd == start_dir) { return *it; @@ -2136,7 +2136,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND"); // CPack - std::string workingDir = mf->GetStartOutputDirectory(); + std::string workingDir = mf->GetCurrentBinaryDirectory(); cmCustomCommandLines cpackCommandLines; std::vector<std::string> depends; cmCustomCommandLine singleLine; @@ -2147,7 +2147,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) singleLine.push_back(cmakeCfgIntDir); } singleLine.push_back("--config"); - std::string configFile = mf->GetStartOutputDirectory();; + std::string configFile = mf->GetCurrentBinaryDirectory();; configFile += "/CPackConfig.cmake"; std::string relConfigFile = "./CPackConfig.cmake"; singleLine.push_back(relConfigFile); @@ -2183,7 +2183,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) depends.erase(depends.begin(), depends.end()); singleLine.push_back(cmSystemTools::GetCPackCommand()); singleLine.push_back("--config"); - configFile = mf->GetStartOutputDirectory();; + configFile = mf->GetCurrentBinaryDirectory();; configFile += "/CPackSourceConfig.cmake"; relConfigFile = "./CPackSourceConfig.cmake"; singleLine.push_back(relConfigFile); @@ -3070,7 +3070,7 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile() std::vector<std::string> configs; std::string config = mf->GetConfigurations(configs, false); - std::string path = this->CMakeInstance->GetStartOutputDirectory(); + std::string path = this->CMakeInstance->GetHomeOutputDirectory(); path += "/CPackProperties.cmake"; if(!cmSystemTools::FileExists(path.c_str()) && installedFiles.empty()) diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index b9c01fa..98557cc 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -50,7 +50,7 @@ void cmGlobalKdevelopGenerator::Generate() ++it) { cmMakefile* mf = it->second[0]->GetMakefile(); - std::string outputDir=mf->GetStartOutputDirectory(); + std::string outputDir=mf->GetCurrentBinaryDirectory(); std::string projectDir=mf->GetHomeDirectory(); std::string projectName=mf->GetProjectName(); std::string cmakeFilePattern("CMakeLists.txt;*.cmake;"); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 79a7914..76f2e14 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -679,7 +679,7 @@ void cmGlobalNinjaGenerator // Compute full path to object file directory for this target. std::string dir; - dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += gt->LocalGenerator->GetTargetDirectory(*target); dir += "/"; @@ -886,7 +886,7 @@ cmGlobalNinjaGenerator case cmTarget::OBJECT_LIBRARY: case cmTarget::UTILITY: { std::string path = ng->ConvertToNinjaPath( - target->GetMakefile()->GetStartOutputDirectory()); + target->GetMakefile()->GetCurrentBinaryDirectory()); if (path.empty() || path == ".") outputs.push_back(target->GetName()); else { diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 22d633c..8cf6be1 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -113,7 +113,7 @@ cmGlobalUnixMakefileGenerator3 // Compute full path to object file directory for this target. std::string dir; - dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += gt->LocalGenerator->GetTargetDirectory(*target); dir += "/"; @@ -158,7 +158,7 @@ void cmGlobalUnixMakefileGenerator3::Generate() { cmLocalUnixMakefileGenerator3 *lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); - std::string markFileName = lg->GetMakefile()->GetStartOutputDirectory(); + std::string markFileName = lg->GetMakefile()->GetCurrentBinaryDirectory(); markFileName += "/"; markFileName += cmake::GetCMakeFilesDirectory(); markFileName += "/progress.marks"; @@ -390,7 +390,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() { lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]); - tmpStr = lg->GetMakefile()->GetStartOutputDirectory(); + tmpStr = lg->GetMakefile()->GetCurrentBinaryDirectory(); tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" << @@ -449,7 +449,7 @@ cmGlobalUnixMakefileGenerator3 bool check_relink) { // Get the relative path to the subdirectory from the top. - std::string makeTarget = lg->GetMakefile()->GetStartOutputDirectory(); + std::string makeTarget = lg->GetMakefile()->GetCurrentBinaryDirectory(); makeTarget += "/"; makeTarget += pass; @@ -494,7 +494,7 @@ cmGlobalUnixMakefileGenerator3 { cmLocalUnixMakefileGenerator3* slg = static_cast<cmLocalUnixMakefileGenerator3*>(*sdi); - std::string subdir = slg->GetMakefile()->GetStartOutputDirectory(); + std::string subdir = slg->GetMakefile()->GetCurrentBinaryDirectory(); subdir += "/"; subdir += pass; depends.push_back(subdir); @@ -529,7 +529,7 @@ cmGlobalUnixMakefileGenerator3 } // Begin the directory-level rules section. - std::string dir = lg->GetMakefile()->GetStartOutputDirectory(); + std::string dir = lg->GetMakefile()->GetCurrentBinaryDirectory(); dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKERULE); lg->WriteDivider(ruleFileStream); @@ -583,11 +583,10 @@ void cmGlobalUnixMakefileGenerator3 lg = static_cast<cmLocalUnixMakefileGenerator3 *> (this->CreateLocalGenerator()); // set the Start directories - lg->GetMakefile()->SetStartDirectory - (this->CMakeInstance->GetStartDirectory()); - lg->GetMakefile()->SetStartOutputDirectory - (this->CMakeInstance->GetStartOutputDirectory()); - lg->GetMakefile()->MakeStartDirectoriesCurrent(); + lg->GetMakefile()->SetCurrentSourceDirectory + (this->CMakeInstance->GetHomeDirectory()); + lg->GetMakefile()->SetCurrentBinaryDirectory + (this->CMakeInstance->GetHomeOutputDirectory()); } std::string tname = targetName; diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 231b679..8240099 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -338,7 +338,7 @@ void cmGlobalVisualStudio10Generator::Generate() " " << this->LongestSource.SourceFile->GetFullPath() << "\n" "This is because some Visual Studio tools would append the relative " "path to the end of the referencing directory path, as in:\n" - " " << mf->GetCurrentOutputDirectory() << "/" + " " << mf->GetCurrentBinaryDirectory() << "/" << this->LongestSource.SourceRel << "\n" "and then incorrectly complain that the file does not exist because " "the path length is too long for some internal buffer or API. " @@ -585,7 +585,7 @@ cmGlobalVisualStudio10Generator void cmGlobalVisualStudio10Generator::PathTooLong( cmTarget* target, cmSourceFile const* sf, std::string const& sfRel) { - size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) + + size_t len = (strlen(target->GetMakefile()->GetCurrentBinaryDirectory()) + 1 + sfRel.length()); if(len > this->LongestSource.Length) { diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index e268852..0852db6 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -239,7 +239,7 @@ void cmGlobalVisualStudio6Generator else { std::string dspname = GetVS6TargetName(target->GetName()); - std::string dir = target->GetMakefile()->GetStartOutputDirectory(); + std::string dir = target->GetMakefile()->GetCurrentBinaryDirectory(); dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT); this->WriteProject(fout, dspname.c_str(), dir.c_str(), *target); } @@ -257,7 +257,7 @@ void cmGlobalVisualStudio6Generator { return; } - std::string fname = root->GetMakefile()->GetStartOutputDirectory(); + std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory(); fname += "/"; fname += root->GetMakefile()->GetProjectName(); fname += ".dsw"; @@ -386,7 +386,7 @@ cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget const* target) std::string pname = target->GetName(); pname += "_UTILITY"; pname = GetVS6TargetName(pname.c_str()); - std::string fname = target->GetMakefile()->GetStartOutputDirectory(); + std::string fname = target->GetMakefile()->GetCurrentBinaryDirectory(); fname += "/"; fname += pname; fname += ".dsp"; diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0d7dfd7..1b03193 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -379,7 +379,7 @@ void cmGlobalVisualStudio7Generator return; } this->CurrentProject = root->GetMakefile()->GetProjectName(); - std::string fname = root->GetMakefile()->GetStartOutputDirectory(); + std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory(); fname += "/"; fname += root->GetMakefile()->GetProjectName(); fname += ".sln"; @@ -485,7 +485,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( if(vcprojName) { cmMakefile* tmf = target->GetMakefile(); - std::string dir = tmf->GetStartOutputDirectory(); + std::string dir = tmf->GetCurrentBinaryDirectory(); dir = root->Convert(dir.c_str(), cmLocalGenerator::START_OUTPUT); if(dir == ".") @@ -561,7 +561,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends( target->GetProperty("GENERATOR_FILE_NAME"); if (vcprojName) { - std::string dir = mf->GetStartDirectory(); + std::string dir = mf->GetCurrentSourceDirectory(); this->WriteProjectDepends(fout, vcprojName, dir.c_str(), *target); } @@ -903,7 +903,7 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target) { std::string pname = target->GetName(); pname += "_UTILITY"; - std::string fname = target->GetMakefile()->GetStartOutputDirectory(); + std::string fname = target->GetMakefile()->GetCurrentBinaryDirectory(); fname += "/"; fname += pname; fname += ".vcproj"; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 726db0f..bb50633 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -281,7 +281,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() stampList += "generate.stamp.list"; { std::string stampListFile = - generators[0]->GetMakefile()->GetCurrentOutputDirectory(); + generators[0]->GetMakefile()->GetCurrentBinaryDirectory(); stampListFile += "/"; stampListFile += stampList; std::string stampFile; @@ -289,7 +289,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() for(std::vector<cmLocalGenerator*>::const_iterator gi = generators.begin(); gi != generators.end(); ++gi) { - stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); + stampFile = (*gi)->GetMakefile()->GetCurrentBinaryDirectory(); stampFile += "/"; stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); stampFile += "generate.stamp"; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 320a1f4..60d545b 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -121,7 +121,7 @@ void cmGlobalVisualStudioGenerator::Generate() void cmGlobalVisualStudioGenerator ::ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const { - std::string dir = gt->Makefile->GetCurrentOutputDirectory(); + std::string dir = gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; std::string tgtDir = gt->LocalGenerator->GetTargetDirectory(*gt->Target); if(!tgtDir.empty()) @@ -225,7 +225,7 @@ cmGlobalVisualStudioGenerator } else { - topLevelSlnName = mf->GetStartOutputDirectory(); + topLevelSlnName = mf->GetCurrentBinaryDirectory(); topLevelSlnName += "/"; topLevelSlnName += mf->GetProjectName(); topLevelSlnName += ".sln"; diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 04befee..d333c1d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -407,13 +407,13 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) { this->CurrentProject = root->GetMakefile()->GetProjectName(); this->SetCurrentLocalGenerator(root); - cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentDirectory(), + cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(), this->ProjectSourceDirectoryComponents); - cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentOutputDirectory(), + cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentBinaryDirectory(), this->ProjectOutputDirectoryComponents); this->CurrentXCodeHackMakefile = - root->GetMakefile()->GetCurrentOutputDirectory(); + root->GetMakefile()->GetCurrentBinaryDirectory(); this->CurrentXCodeHackMakefile += "/CMakeScripts"; cmSystemTools::MakeDirectory(this->CurrentXCodeHackMakefile.c_str()); this->CurrentXCodeHackMakefile += "/XCODE_DEPEND_HELPER.make"; @@ -453,13 +453,13 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, cmTarget* allbuild = mf->FindTarget("ALL_BUILD"); // Refer to the main build configuration file for easy editing. - std::string listfile = mf->GetStartDirectory(); + std::string listfile = mf->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; allbuild->AddSourceCMP0049(listfile.c_str()); // Add XCODE depend helper - std::string dir = mf->GetCurrentOutputDirectory(); + std::string dir = mf->GetCurrentBinaryDirectory(); cmCustomCommandLine makeHelper; if(this->XcodeVersion < 50) { @@ -538,7 +538,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, } // Refer to the build configuration file for easy editing. - listfile = lg->GetMakefile()->GetStartDirectory(); + listfile = lg->GetMakefile()->GetCurrentSourceDirectory(); listfile += "/"; listfile += "CMakeLists.txt"; target.AddSourceCMP0049(listfile.c_str()); @@ -564,7 +564,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile( std::vector<std::string>::iterator new_end = std::unique(lfiles.begin(), lfiles.end()); lfiles.erase(new_end, lfiles.end()); - this->CurrentReRunCMakeMakefile = mf->GetStartOutputDirectory(); + this->CurrentReRunCMakeMakefile = mf->GetCurrentBinaryDirectory(); this->CurrentReRunCMakeMakefile += "/CMakeScripts"; cmSystemTools::MakeDirectory(this->CurrentReRunCMakeMakefile.c_str()); this->CurrentReRunCMakeMakefile += "/ReRunCMake.make"; @@ -1012,7 +1012,7 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen) this->CurrentMakefile = gen->GetMakefile(); std::string outdir = cmSystemTools::CollapseFullPath(this->CurrentMakefile-> - GetCurrentOutputDirectory()); + GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir.c_str(), this->CurrentOutputDirectoryComponents); @@ -1366,7 +1366,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmTarget& cmtarget) // linker language. This should convince Xcode to choose the proper // language. cmMakefile* mf = cmtarget.GetMakefile(); - std::string fname = mf->GetCurrentOutputDirectory(); + std::string fname = mf->GetCurrentBinaryDirectory(); fname += cmake::GetCMakeFilesDirectory(); fname += "/"; fname += cmtarget.GetName(); @@ -1594,7 +1594,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, const & commands, const char* name) { - std::string dir = this->CurrentMakefile->GetCurrentOutputDirectory(); + std::string dir = this->CurrentMakefile->GetCurrentBinaryDirectory(); dir += "/CMakeScripts"; cmSystemTools::MakeDirectory(dir.c_str()); std::string makefile = dir; @@ -1615,7 +1615,7 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase, currentConfig->c_str()); } - std::string cdir = this->CurrentMakefile->GetCurrentOutputDirectory(); + std::string cdir = this->CurrentMakefile->GetCurrentBinaryDirectory(); cdir = this->ConvertToRelativeForXCode(cdir.c_str()); std::string makecmd = "make -C "; makecmd += cdir; @@ -1943,7 +1943,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, } // Set attributes to specify the proper name for the target. - std::string pndir = this->CurrentMakefile->GetCurrentOutputDirectory(); + std::string pndir = this->CurrentMakefile->GetCurrentBinaryDirectory(); if(target.GetType() == cmTarget::STATIC_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY || @@ -3342,7 +3342,7 @@ bool cmGlobalXCodeGenerator // Point Xcode at the top of the source tree. { std::string pdir = - this->RelativeToBinary(root->GetMakefile()->GetCurrentDirectory()); + this->RelativeToBinary(root->GetMakefile()->GetCurrentSourceDirectory()); this->RootObject->AddAttribute("projectDirPath", this->CreateString(pdir.c_str())); this->RootObject->AddAttribute("projectRoot", this->CreateString("")); @@ -3454,7 +3454,7 @@ bool cmGlobalXCodeGenerator } } - std::string symroot = root->GetMakefile()->GetCurrentOutputDirectory(); + std::string symroot = root->GetMakefile()->GetCurrentBinaryDirectory(); symroot += "/build"; buildSettings->AddAttribute("SYMROOT", this->CreateString(symroot.c_str())); @@ -3516,7 +3516,7 @@ cmGlobalXCodeGenerator::GetObjectsNormalDirectory( const cmTarget *t) const { std::string dir = - t->GetMakefile()->GetCurrentOutputDirectory(); + t->GetMakefile()->GetCurrentBinaryDirectory(); dir += "/"; dir += projName; dir += ".build/"; @@ -3696,7 +3696,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root, { return; } - std::string xcodeDir = root->GetMakefile()->GetStartOutputDirectory(); + std::string xcodeDir = root->GetMakefile()->GetCurrentBinaryDirectory(); xcodeDir += "/"; xcodeDir += root->GetMakefile()->GetProjectName(); xcodeDir += ".xcode"; @@ -4016,7 +4016,7 @@ void cmGlobalXCodeGenerator::AppendFlag(std::string& flags, std::string cmGlobalXCodeGenerator::ComputeInfoPListLocation(cmTarget& target) { - std::string plist = target.GetMakefile()->GetCurrentOutputDirectory(); + std::string plist = target.GetMakefile()->GetCurrentBinaryDirectory(); plist += cmake::GetCMakeFilesDirectory(); plist += "/"; plist += target.GetName(); diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 18e3585..132b650 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -91,7 +91,7 @@ bool cmIncludeCommand std::string fname_abs = cmSystemTools::CollapseFullPath(fname, - this->Makefile->GetStartDirectory()); + this->Makefile->GetCurrentSourceDirectory()); cmGlobalGenerator *gg = this->Makefile->GetLocalGenerator() ->GetGlobalGenerator(); diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index 464b4c2..5c28cfd 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -149,7 +149,7 @@ void cmIncludeDirectoryCommand::NormalizeInclude(std::string &inc) { if(!StartsWithGeneratorExpression(inc)) { - std::string tmp = this->Makefile->GetStartDirectory(); + std::string tmp = this->Makefile->GetCurrentSourceDirectory(); tmp += "/"; tmp += inc; inc = tmp; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 2d7d7cc..fac9641 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -163,7 +163,7 @@ bool cmInstallCommand::HandleScriptMode(std::vector<std::string> const& args) std::string script = args[i]; if(!cmSystemTools::FileIsFullPath(script.c_str())) { - script = this->Makefile->GetCurrentDirectory(); + script = this->Makefile->GetCurrentSourceDirectory(); script += "/"; script += args[i]; } @@ -1093,7 +1093,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) std::string dir = args[i]; if(!cmSystemTools::FileIsFullPath(dir.c_str())) { - dir = this->Makefile->GetCurrentDirectory(); + dir = this->Makefile->GetCurrentSourceDirectory(); dir += "/"; dir += args[i]; } @@ -1376,7 +1376,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName, std::string::size_type gpos = cmGeneratorExpression::Find(file); if(gpos != 0 && !cmSystemTools::FileIsFullPath(file.c_str())) { - file = this->Makefile->GetCurrentDirectory(); + file = this->Makefile->GetCurrentSourceDirectory(); file += "/"; file += *fileIt; } diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 38c80df..7f6aa4d 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -59,7 +59,7 @@ void cmInstallExportGenerator::ComputeTempDir() { // Choose a temporary directory in which to generate the import // files to be installed. - this->TempDir = this->Makefile->GetCurrentOutputDirectory(); + this->TempDir = this->Makefile->GetCurrentBinaryDirectory(); this->TempDir += cmake::GetCMakeFilesDirectory(); this->TempDir += "/Export"; if(this->Destination.empty()) diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 85e5345..1fe435c 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -95,7 +95,7 @@ void cmInstallFilesCommand::FinalPass() { std::vector<std::string> files; std::string regex = this->FinalArgs[0]; - cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), + cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(), regex, files); std::vector<std::string>::iterator s = files.begin(); @@ -152,10 +152,10 @@ std::string cmInstallFilesCommand::FindInstallSource(const char* name) const } // This is a relative path. - std::string tb = this->Makefile->GetCurrentOutputDirectory(); + std::string tb = this->Makefile->GetCurrentBinaryDirectory(); tb += "/"; tb += name; - std::string ts = this->Makefile->GetCurrentDirectory(); + std::string ts = this->Makefile->GetCurrentSourceDirectory(); ts += "/"; ts += name; diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index cc223ab..4899b95 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -63,7 +63,7 @@ void cmInstallProgramsCommand::FinalPass() else // reg exp list { std::vector<std::string> programs; - cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), + cmSystemTools::Glob(this->Makefile->GetCurrentSourceDirectory(), this->FinalArgs[0], programs); std::vector<std::string>::iterator s = programs.begin(); @@ -115,10 +115,10 @@ std::string cmInstallProgramsCommand } // This is a relative path. - std::string tb = this->Makefile->GetCurrentOutputDirectory(); + std::string tb = this->Makefile->GetCurrentBinaryDirectory(); tb += "/"; tb += name; - std::string ts = this->Makefile->GetCurrentDirectory(); + std::string ts = this->Makefile->GetCurrentSourceDirectory(); ts += "/"; ts += name; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index b035bad..11125d3 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -69,7 +69,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::string fromDirConfig; if(this->Target->NeedRelinkBeforeInstall(config)) { - fromDirConfig = this->Target->GetMakefile()->GetStartOutputDirectory(); + fromDirConfig = this->Target->GetMakefile()->GetCurrentBinaryDirectory(); fromDirConfig += cmake::GetCMakeFilesDirectory(); fromDirConfig += "/CMakeRelink.dir/"; } diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index ade1feb..a21f517 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -60,7 +60,7 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) } if (convertToAbsolute) { - std::string tmp = this->Makefile->GetStartDirectory(); + std::string tmp = this->Makefile->GetCurrentSourceDirectory(); tmp += "/"; tmp += unixPath; unixPath = tmp; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 946a020..dc74374 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -101,7 +101,7 @@ void cmLocalGenerator::Configure() static_cast<void>(clg); // make sure the CMakeFiles dir is there - std::string filesDir = this->Makefile->GetStartOutputDirectory(); + std::string filesDir = this->Makefile->GetCurrentBinaryDirectory(); filesDir += cmake::GetCMakeFilesDirectory(); cmSystemTools::MakeDirectory(filesDir.c_str()); @@ -177,7 +177,7 @@ void cmLocalGenerator::ComputeObjectMaxPath() void cmLocalGenerator::ReadInputFile() { // Look for the CMakeLists.txt file. - std::string currentStart = this->Makefile->GetStartDirectory(); + std::string currentStart = this->Makefile->GetCurrentSourceDirectory(); currentStart += "/CMakeLists.txt"; if(cmSystemTools::FileExists(currentStart.c_str(), true)) { @@ -194,7 +194,7 @@ void cmLocalGenerator::ReadInputFile() cmMakefile* mf = this->Parent->GetMakefile(); std::ostringstream e; e << "The source directory\n" - << " " << this->Makefile->GetStartDirectory() << "\n" + << " " << this->Makefile->GetCurrentSourceDirectory() << "\n" << "does not contain a CMakeLists.txt file."; switch (mf->GetPolicyStatus(cmPolicies::CMP0014)) { @@ -230,7 +230,8 @@ void cmLocalGenerator::SetupPathConversions() cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory()); cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); outdir = - cmSystemTools::CollapseFullPath(this->Makefile->GetStartDirectory()); + cmSystemTools::CollapseFullPath( + this->Makefile->GetCurrentSourceDirectory()); cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath @@ -239,7 +240,7 @@ void cmLocalGenerator::SetupPathConversions() this->HomeOutputDirectoryComponents); outdir = cmSystemTools::CollapseFullPath - (this->Makefile->GetStartOutputDirectory()); + (this->Makefile->GetCurrentBinaryDirectory()); cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); } @@ -250,12 +251,6 @@ void cmLocalGenerator::SetGlobalGenerator(cmGlobalGenerator *gg) this->GlobalGenerator = gg; this->Makefile = new cmMakefile; this->Makefile->SetLocalGenerator(this); - - // setup the home directories - this->Makefile->SetHomeDirectory( - gg->GetCMakeInstance()->GetHomeDirectory()); - this->Makefile->SetHomeOutputDirectory( - gg->GetCMakeInstance()->GetHomeOutputDirectory()); } void cmLocalGenerator::ConfigureFinalPass() @@ -302,7 +297,7 @@ void cmLocalGenerator::GenerateTestFiles() const std::string& config = this->Makefile->GetConfigurations(configurationTypes, false); - std::string file = this->Makefile->GetStartOutputDirectory(); + std::string file = this->Makefile->GetCurrentBinaryDirectory(); file += "/"; file += "CTestTestfile.cmake"; @@ -311,9 +306,9 @@ void cmLocalGenerator::GenerateTestFiles() fout << "# CMake generated Testfile for " << std::endl << "# Source directory: " - << this->Makefile->GetStartDirectory() << std::endl + << this->Makefile->GetCurrentSourceDirectory() << std::endl << "# Build directory: " - << this->Makefile->GetStartOutputDirectory() << std::endl + << this->Makefile->GetCurrentBinaryDirectory() << std::endl << "# " << std::endl << "# This file includes the relevant testing commands " << "required for " << std::endl @@ -343,7 +338,7 @@ void cmLocalGenerator::GenerateTestFiles() // TODO: Use add_subdirectory instead? fout << "subdirs("; std::string outP = - this->Children[i]->GetMakefile()->GetStartOutputDirectory(); + this->Children[i]->GetMakefile()->GetCurrentBinaryDirectory(); fout << this->Convert(outP,START_OUTPUT); fout << ")" << std::endl; } @@ -427,9 +422,9 @@ void cmLocalGenerator::GenerateInstallRules() } // Create the install script file. - std::string file = this->Makefile->GetStartOutputDirectory(); + std::string file = this->Makefile->GetCurrentBinaryDirectory(); std::string homedir = this->Makefile->GetHomeOutputDirectory(); - std::string currdir = this->Makefile->GetCurrentOutputDirectory(); + std::string currdir = this->Makefile->GetCurrentBinaryDirectory(); cmSystemTools::ConvertToUnixSlashes(file); cmSystemTools::ConvertToUnixSlashes(homedir); cmSystemTools::ConvertToUnixSlashes(currdir); @@ -444,7 +439,8 @@ void cmLocalGenerator::GenerateInstallRules() // Write the header. fout << "# Install script for directory: " - << this->Makefile->GetCurrentDirectory() << std::endl << std::endl; + << this->Makefile->GetCurrentSourceDirectory() + << std::endl << std::endl; fout << "# Set the install prefix" << std::endl << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl @@ -516,7 +512,7 @@ void cmLocalGenerator::GenerateInstallRules() { if(!(*ci)->GetMakefile()->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { - std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory(); + std::string odir = (*ci)->GetMakefile()->GetCurrentBinaryDirectory(); cmSystemTools::ConvertToUnixSlashes(odir); fout << " include(\"" << odir << "/cmake_install.cmake\")" << std::endl; @@ -652,7 +648,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, source.GetFullPath(), commandLines, comment.c_str(), - this->Makefile->GetStartOutputDirectory() + this->Makefile->GetCurrentBinaryDirectory() ); } @@ -674,12 +670,12 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, !sf->GetPropertyAsBool("EXTERNAL_OBJECT")) { std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += "/"; std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max); if(!obj.empty()) { - std::string ofname = this->Makefile->GetCurrentOutputDirectory(); + std::string ofname = this->Makefile->GetCurrentBinaryDirectory(); ofname += "/"; ofname += obj; objVector.push_back(ofname); @@ -749,7 +745,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, "", commandLines, comment.c_str(), - this->Makefile->GetStartOutputDirectory() + this->Makefile->GetCurrentBinaryDirectory() ); this->Makefile->GetSource(targetFullPath); target.Target->AddSource(targetFullPath); @@ -1553,18 +1549,19 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, if(includeBinaryDir) { if(emitted.find( - this->Makefile->GetStartOutputDirectory()) == emitted.end()) + this->Makefile->GetCurrentBinaryDirectory()) == emitted.end()) { - dirs.push_back(this->Makefile->GetStartOutputDirectory()); - emitted.insert(this->Makefile->GetStartOutputDirectory()); + dirs.push_back(this->Makefile->GetCurrentBinaryDirectory()); + emitted.insert(this->Makefile->GetCurrentBinaryDirectory()); } } if(includeSourceDir) { - if(emitted.find(this->Makefile->GetStartDirectory()) == emitted.end()) + if(emitted.find( + this->Makefile->GetCurrentSourceDirectory()) == emitted.end()) { - dirs.push_back(this->Makefile->GetStartDirectory()); - emitted.insert(this->Makefile->GetStartDirectory()); + dirs.push_back(this->Makefile->GetCurrentSourceDirectory()); + emitted.insert(this->Makefile->GetCurrentSourceDirectory()); } } @@ -2165,7 +2162,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, // Treat the name as relative to the source directory in which it // was given. - dep = this->Makefile->GetCurrentDirectory(); + dep = this->Makefile->GetCurrentSourceDirectory(); dep += "/"; dep += inName; return true; @@ -2719,9 +2716,9 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot) switch (relroot) { case HOME: return this->Makefile->GetHomeDirectory(); - case START: return this->Makefile->GetStartDirectory(); + case START: return this->Makefile->GetCurrentSourceDirectory(); case HOME_OUTPUT: return this->Makefile->GetHomeOutputDirectory(); - case START_OUTPUT: return this->Makefile->GetStartOutputDirectory(); + case START_OUTPUT: return this->Makefile->GetCurrentBinaryDirectory(); default: break; } return 0; @@ -2849,14 +2846,14 @@ std::string cmLocalGenerator::FindRelativePathTopSource() { std::string parentTop = parent->FindRelativePathTopSource(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetStartDirectory(), parentTop)) + this->Makefile->GetCurrentSourceDirectory(), parentTop)) { return parentTop; } } // Otherwise this directory itself is the new top. - return this->Makefile->GetStartDirectory(); + return this->Makefile->GetCurrentSourceDirectory(); } //---------------------------------------------------------------------------- @@ -2869,14 +2866,14 @@ std::string cmLocalGenerator::FindRelativePathTopBinary() { std::string parentTop = parent->FindRelativePathTopBinary(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetStartOutputDirectory(), parentTop)) + this->Makefile->GetCurrentBinaryDirectory(), parentTop)) { return parentTop; } } // Otherwise this directory itself is the new top. - return this->Makefile->GetStartOutputDirectory(); + return this->Makefile->GetCurrentBinaryDirectory(); } //---------------------------------------------------------------------------- diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 782fec4..a3edc45 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -46,7 +46,7 @@ void cmLocalGhsMultiGenerator::Configure() // Compute the path to use when referencing the current output // directory from the top output directory. this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); if (this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 645d32a..d4741a0 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -102,7 +102,7 @@ void cmLocalNinjaGenerator::Configure() // Compute the path to use when referencing the current output // directory from the top output directory. this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); if(this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; @@ -407,7 +407,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines( if (ccg.GetNumberOfCommands() > 0) { std::string wd = ccg.GetWorkingDirectory(); if (wd.empty()) - wd = this->GetMakefile()->GetStartOutputDirectory(); + wd = this->GetMakefile()->GetCurrentBinaryDirectory(); std::ostringstream cdCmd; #ifdef _WIN32 diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 153ed09..f66b54a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -106,7 +106,7 @@ void cmLocalUnixMakefileGenerator3::Configure() // Compute the path to use when referencing the current output // directory from the top output directory. this->HomeRelativeOutputPath = - this->Convert(this->Makefile->GetStartOutputDirectory(), HOME_OUTPUT); + this->Convert(this->Makefile->GetCurrentBinaryDirectory(), HOME_OUTPUT); if(this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; @@ -205,7 +205,7 @@ GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles) ->GetSafeDefinition("CMAKE_BUILD_TYPE")); // Compute full path to object file directory for this target. std::string dir; - dir += gt->Makefile->GetCurrentOutputDirectory(); + dir += gt->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += this->GetTargetDirectory(*gt->Target); dir += "/"; @@ -526,7 +526,7 @@ void cmLocalUnixMakefileGenerator3 //---------------------------------------------------------------------------- void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() { - std::string infoFileName = this->Makefile->GetStartOutputDirectory(); + std::string infoFileName = this->Makefile->GetCurrentBinaryDirectory(); infoFileName += cmake::GetCMakeFilesDirectory(); infoFileName += "/CMakeDirectoryInformation.cmake"; @@ -588,7 +588,7 @@ std::string cmLocalUnixMakefileGenerator3 ::ConvertToFullPath(const std::string& localPath) { - std::string dir = this->Makefile->GetStartOutputDirectory(); + std::string dir = this->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += localPath; return dir; @@ -1086,7 +1086,7 @@ cmLocalUnixMakefileGenerator3 } // if the command specified a working directory use it. - std::string dir = this->Makefile->GetStartOutputDirectory(); + std::string dir = this->Makefile->GetCurrentBinaryDirectory(); std::string workingDir = ccg.GetWorkingDirectory(); if(!workingDir.empty()) { @@ -1236,7 +1236,7 @@ cmLocalUnixMakefileGenerator3 const std::vector<std::string>& files, cmTarget& target, const char* filename) { - std::string cleanfile = this->Makefile->GetCurrentOutputDirectory(); + std::string cleanfile = this->Makefile->GetCurrentBinaryDirectory(); cleanfile += "/"; cleanfile += this->GetTargetDirectory(target); cleanfile += "/cmake_clean"; @@ -1515,7 +1515,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, // If the directory information is newer than depend.internal, include dirs // may have changed. In this case discard all old dependencies. bool needRescanDirInfo = false; - std::string dirInfoFile = this->Makefile->GetStartOutputDirectory(); + std::string dirInfoFile = this->Makefile->GetCurrentBinaryDirectory(); dirInfoFile += cmake::GetCMakeFilesDirectory(); dirInfoFile += "/CMakeDirectoryInformation.cmake"; { @@ -1589,7 +1589,7 @@ cmLocalUnixMakefileGenerator3 // Read the directory information file. cmMakefile* mf = this->Makefile; bool haveDirectoryInfo = false; - std::string dirInfoFile = this->Makefile->GetStartOutputDirectory(); + std::string dirInfoFile = this->Makefile->GetCurrentBinaryDirectory(); dirInfoFile += cmake::GetCMakeFilesDirectory(); dirInfoFile += "/CMakeDirectoryInformation.cmake"; if(mf->ReadListFile(dirInfoFile.c_str()) && @@ -1847,7 +1847,7 @@ void cmLocalUnixMakefileGenerator3 // Write the all rule. std::string dir; - std::string recursiveTarget = this->Makefile->GetStartOutputDirectory(); + std::string recursiveTarget = this->Makefile->GetCurrentBinaryDirectory(); recursiveTarget += "/all"; depends.push_back("cmake_check_build_system"); @@ -1891,7 +1891,7 @@ void cmLocalUnixMakefileGenerator3 depends, commands, true); // Write the clean rule. - recursiveTarget = this->Makefile->GetStartOutputDirectory(); + recursiveTarget = this->Makefile->GetCurrentBinaryDirectory(); recursiveTarget += "/clean"; commands.clear(); depends.clear(); @@ -1909,7 +1909,7 @@ void cmLocalUnixMakefileGenerator3 depends, commands, true); // Write the preinstall rule. - recursiveTarget = this->Makefile->GetStartOutputDirectory(); + recursiveTarget = this->Makefile->GetCurrentBinaryDirectory(); recursiveTarget += "/preinstall"; commands.clear(); depends.clear(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 6844fee..69da9fb 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -117,14 +117,14 @@ void cmLocalVisualStudio6Generator::Generate() void cmLocalVisualStudio6Generator::OutputDSPFile() { // If not an in source build, then create the output directory - if(strcmp(this->Makefile->GetStartOutputDirectory(), + if(strcmp(this->Makefile->GetCurrentBinaryDirectory(), this->Makefile->GetHomeDirectory()) != 0) { if(!cmSystemTools::MakeDirectory - (this->Makefile->GetStartOutputDirectory())) + (this->Makefile->GetCurrentBinaryDirectory())) { cmSystemTools::Error("Error creating directory ", - this->Makefile->GetStartOutputDirectory()); + this->Makefile->GetCurrentBinaryDirectory()); } } @@ -169,7 +169,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() std::string::size_type pos = l->first.rfind('/'); if(pos != std::string::npos) { - std::string dir = this->Makefile->GetStartOutputDirectory(); + std::string dir = this->Makefile->GetCurrentBinaryDirectory(); dir += "/"; dir += l->first.substr(0, pos); if(!cmSystemTools::MakeDirectory(dir.c_str())) @@ -195,7 +195,7 @@ void cmLocalVisualStudio6Generator::CreateSingleDSP(const std::string& lname, // create the dsp.cmake file std::string fname; - fname = this->Makefile->GetStartOutputDirectory(); + fname = this->Makefile->GetCurrentBinaryDirectory(); fname += "/"; fname += pname; fname += ".dsp"; @@ -223,7 +223,7 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt) this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); cmCustomCommandLine commandLine; commandLine.push_back(dsprule); - std::string makefileIn = this->Makefile->GetStartDirectory(); + std::string makefileIn = this->Makefile->GetCurrentSourceDirectory(); makefileIn += "/"; makefileIn += "CMakeLists.txt"; if(!cmSystemTools::FileExists(makefileIn.c_str())) @@ -585,9 +585,9 @@ cmLocalVisualStudio6Generator const cmCustomCommand& origCommand) { // Create a fake output that forces the rule to run. - char* output = new char[(strlen(this->Makefile->GetStartOutputDirectory()) + - target.GetName().size() + 30)]; - sprintf(output,"%s/%s_force_%i", this->Makefile->GetStartOutputDirectory(), + char* output = new char[(strlen(this->Makefile->GetCurrentBinaryDirectory()) + + target.GetName().size() + 30)]; + sprintf(output,"%s/%s_force_%i", this->Makefile->GetCurrentBinaryDirectory(), target.GetName().c_str(), count); const char* comment = origCommand.GetComment(); if(!comment && origCommand.GetOutputs().empty()) @@ -1968,7 +1968,7 @@ cmLocalVisualStudio6Generator // files directory for any configuration. This is used to construct // object file names that do not produce paths that are too long. std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += "/"; dir_max += config_max; dir_max += "/"; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 884212b..928481c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -151,7 +151,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() cmCustomCommandLines force_commands; force_commands.push_back(force_command); std::string no_main_dependency = ""; - std::string force = this->Makefile->GetStartOutputDirectory(); + std::string force = this->Makefile->GetCurrentBinaryDirectory(); force += cmake::GetCMakeFilesDirectory(); force += "/"; force += tgt.GetName(); @@ -173,14 +173,14 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() void cmLocalVisualStudio7Generator::WriteProjectFiles() { // If not an in source build, then create the output directory - if(strcmp(this->Makefile->GetStartOutputDirectory(), + if(strcmp(this->Makefile->GetCurrentBinaryDirectory(), this->Makefile->GetHomeDirectory()) != 0) { if(!cmSystemTools::MakeDirectory - (this->Makefile->GetStartOutputDirectory())) + (this->Makefile->GetCurrentBinaryDirectory())) { cmSystemTools::Error("Error creating directory ", - this->Makefile->GetStartOutputDirectory()); + this->Makefile->GetCurrentBinaryDirectory()); } } @@ -209,7 +209,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles() { // Touch a timestamp file used to determine when the project file is // out of date. - std::string stampName = this->Makefile->GetStartOutputDirectory(); + std::string stampName = this->Makefile->GetCurrentBinaryDirectory(); stampName += cmake::GetCMakeFilesDirectory(); cmSystemTools::MakeDirectory(stampName.c_str()); stampName += "/"; @@ -257,7 +257,7 @@ void cmLocalVisualStudio7Generator target.SetProperty("GENERATOR_FILE_NAME",lname.c_str()); // create the dsp.cmake file std::string fname; - fname = this->Makefile->GetStartOutputDirectory(); + fname = this->Makefile->GetCurrentBinaryDirectory(); fname += "/"; fname += lname; if(this->FortranProject) @@ -286,7 +286,7 @@ void cmLocalVisualStudio7Generator //---------------------------------------------------------------------------- cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() { - std::string stampName = this->Makefile->GetCurrentOutputDirectory(); + std::string stampName = this->Makefile->GetCurrentBinaryDirectory(); stampName += "/"; stampName += cmake::GetCMakeFilesDirectoryPostSlash(); stampName += "generate.stamp"; @@ -294,7 +294,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule() this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"); cmCustomCommandLine commandLine; commandLine.push_back(dsprule); - std::string makefileIn = this->Makefile->GetStartDirectory(); + std::string makefileIn = this->Makefile->GetCurrentSourceDirectory(); makefileIn += "/"; makefileIn += "CMakeLists.txt"; makefileIn = cmSystemTools::CollapseFullPath(makefileIn.c_str()); @@ -1707,7 +1707,7 @@ cmLocalVisualStudio7Generator // files directory for any configuration. This is used to construct // object file names that do not produce paths that are too long. std::string dir_max; - dir_max += this->Makefile->GetCurrentOutputDirectory(); + dir_max += this->Makefile->GetCurrentBinaryDirectory(); dir_max += "/"; dir_max += this->GetTargetDirectory(target); dir_max += "/"; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 83efc05..c77a90c 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -179,11 +179,11 @@ void cmMakefile::Print() const } std::cout << " this->StartOutputDirectory; " << - this->StartOutputDirectory << std::endl; + this->GetCurrentBinaryDirectory() << std::endl; std::cout << " this->HomeOutputDirectory; " << this->HomeOutputDirectory << std::endl; std::cout << " this->cmStartDirectory; " << - this->cmStartDirectory << std::endl; + this->GetCurrentSourceDirectory() << std::endl; std::cout << " this->cmHomeDirectory; " << this->cmHomeDirectory << std::endl; std::cout << " this->ProjectName; " @@ -223,7 +223,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, if(this->ListFileStack.empty()) { // We are not processing the project. Add the directory-level context. - lfc.FilePath = this->GetCurrentDirectory(); + lfc.FilePath = this->GetCurrentSourceDirectory(); lfc.FilePath += "/CMakeLists.txt"; } else @@ -480,8 +480,9 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); this->cmCurrentListFile = listfile; + std::string curSrc = this->GetCurrentSourceDirectory(); return this->ReadListFile(listfile, true, - this->cmStartDirectory == this->cmHomeDirectory); + curSrc == this->GetHomeDirectory()); } bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) @@ -489,7 +490,7 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) this->AddDefinition("CMAKE_PARENT_LIST_FILE", this->GetCurrentListFile()); this->cmCurrentListFile = cmSystemTools::CollapseFullPath(listfile, - this->cmStartDirectory.c_str()); + this->GetCurrentSourceDirectory()); return this->ReadListFile(this->cmCurrentListFile.c_str(), noPolicyScope); } @@ -503,7 +504,7 @@ bool cmMakefile::ReadListFile(const char* listfile, { std::string filenametoread = cmSystemTools::CollapseFullPath(listfile, - this->cmStartDirectory.c_str()); + this->GetCurrentSourceDirectory()); std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); @@ -650,6 +651,9 @@ void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg) this->Properties.SetCMakeInstance(this->GetCMakeInstance()); this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused(); this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars(); + this->SetHomeDirectory(this->GetCMakeInstance()->GetHomeDirectory()); + this->SetHomeOutputDirectory( + this->GetCMakeInstance()->GetHomeOutputDirectory()); } namespace @@ -1187,7 +1191,7 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, // Store the custom command in the target. if (!commandLines.empty() || !depends.empty()) { - std::string force = this->GetStartOutputDirectory(); + std::string force = this->GetCurrentBinaryDirectory(); force += cmake::GetCMakeFilesDirectory(); force += "/"; force += utilityName; @@ -1497,6 +1501,11 @@ void cmMakefile::InitializeFromParent() // Initialize definitions with the closure of the parent scope. this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure(); + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", + this->GetCurrentSourceDirectory()); + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", + this->GetCurrentBinaryDirectory()); + const std::vector<cmValueWithOrigin>& parentIncludes = parent->GetIncludeDirectoriesEntries(); this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(), @@ -1565,11 +1574,10 @@ void cmMakefile::InitializeFromParent() void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) { lg2->GetMakefile()->InitializeFromParent(); - lg2->GetMakefile()->MakeStartDirectoriesCurrent(); if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Entering "; - msg += lg2->GetMakefile()->GetCurrentDirectory(); + msg += lg2->GetMakefile()->GetCurrentSourceDirectory(); cmSystemTools::Message(msg.c_str()); } // finally configure the subdir @@ -1577,7 +1585,7 @@ void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2) if (this->GetCMakeInstance()->GetDebugOutput()) { std::string msg=" Returning to "; - msg += this->GetCurrentDirectory(); + msg += this->GetCurrentSourceDirectory(); cmSystemTools::Message(msg.c_str()); } } @@ -1600,8 +1608,8 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, this->LocalGenerator->GetGlobalGenerator()->AddLocalGenerator(lg2); // set the subdirs start dirs - lg2->GetMakefile()->SetStartDirectory(srcPath); - lg2->GetMakefile()->SetStartOutputDirectory(binPath); + lg2->GetMakefile()->SetCurrentSourceDirectory(srcPath); + lg2->GetMakefile()->SetCurrentBinaryDirectory(binPath); if(excludeFromAll) { lg2->GetMakefile()->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); @@ -1613,6 +1621,37 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, } } +void cmMakefile::SetCurrentSourceDirectory(const std::string& dir) +{ + this->cmStartDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); + this->cmStartDirectory = + cmSystemTools::CollapseFullPath(this->cmStartDirectory); + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", + this->cmStartDirectory.c_str()); +} + +const char* cmMakefile::GetCurrentSourceDirectory() const +{ + return this->cmStartDirectory.c_str(); +} + +void cmMakefile::SetCurrentBinaryDirectory(const std::string& dir) +{ + this->StartOutputDirectory = dir; + cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); + this->StartOutputDirectory = + cmSystemTools::CollapseFullPath(this->StartOutputDirectory); + cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str()); + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", + this->StartOutputDirectory.c_str()); +} + +const char* cmMakefile::GetCurrentBinaryDirectory() const +{ + return this->StartOutputDirectory.c_str(); +} + //---------------------------------------------------------------------------- void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs, bool before) @@ -1809,7 +1848,7 @@ void cmMakefile::CheckForUnused(const char* reason, } else { - path = this->GetStartDirectory(); + path = this->GetCurrentSourceDirectory(); path += "/CMakeLists.txt"; cmListFileContext lfc; lfc.FilePath = path; @@ -3362,9 +3401,9 @@ const char* cmMakefile::GetHomeOutputDirectory() const return this->HomeOutputDirectory.c_str(); } -void cmMakefile::SetHomeOutputDirectory(const std::string& lib) +void cmMakefile::SetHomeOutputDirectory(const std::string& dir) { - this->HomeOutputDirectory = lib; + this->HomeOutputDirectory = dir; cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory()); if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") ) @@ -3491,8 +3530,6 @@ int cmMakefile::TryCompile(const std::string& srcdir, // do a configure cm.SetHomeDirectory(srcdir); cm.SetHomeOutputDirectory(bindir); - cm.SetStartDirectory(srcdir); - cm.SetStartOutputDirectory(bindir); cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform()); cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset()); cm.LoadCache(); @@ -3988,8 +4025,8 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value) if ( prop == "ADDITIONAL_MAKE_CLEAN_FILES" ) { // This property is not inherrited - if ( strcmp(this->GetCurrentDirectory(), - this->GetStartDirectory()) != 0 ) + if ( strcmp(this->GetCurrentSourceDirectory(), + this->GetCurrentSourceDirectory()) != 0 ) { return; } @@ -4053,7 +4090,7 @@ const char *cmMakefile::GetProperty(const std::string& prop, { if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { - output = plg->GetMakefile()->GetStartDirectory(); + output = plg->GetMakefile()->GetCurrentSourceDirectory(); } return output.c_str(); } @@ -4256,7 +4293,7 @@ void cmMakefile::AddCMakeDependFilesFromUser() } else { - std::string f = this->GetCurrentDirectory(); + std::string f = this->GetCurrentSourceDirectory(); f += "/"; f += *i; this->AddCMakeDependFile(f); @@ -4537,7 +4574,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, default: break; } e << "created in source directory \"" - << existing->GetMakefile()->GetCurrentDirectory() << "\". " + << existing->GetMakefile()->GetCurrentSourceDirectory() << "\". " << "See documentation for policy CMP0002 for more details."; msg = e.str(); return false; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e3566c5..46e9391 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -422,14 +422,6 @@ public: bool HasCMP0054AlreadyBeenReported( cmListFileContext context) const; - void MakeStartDirectoriesCurrent() - { - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->cmStartDirectory.c_str()); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->StartOutputDirectory.c_str()); - } - //@{ /** * Set/Get the home directory (or output directory) in the project. The @@ -440,7 +432,7 @@ public: */ void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const; - void SetHomeOutputDirectory(const std::string& lib); + void SetHomeOutputDirectory(const std::string& dir); const char* GetHomeOutputDirectory() const; //@} @@ -454,51 +446,10 @@ public: */ void SetArgcArgv(const std::vector<std::string>& args); - //@{ - /** - * Set/Get the start directory (or output directory). The start directory - * is the directory of the CMakeLists.txt file that started the current - * round of processing. Remember that CMake processes CMakeLists files by - * recursing up the tree starting at the StartDirectory and going up until - * it reaches the HomeDirectory. - */ - void SetStartDirectory(const std::string& dir) - { - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); - this->cmStartDirectory = - cmSystemTools::CollapseFullPath(this->cmStartDirectory); - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->cmStartDirectory.c_str()); - } - const char* GetStartDirectory() const - { - return this->cmStartDirectory.c_str(); - } - void SetStartOutputDirectory(const std::string& lib) - { - this->StartOutputDirectory = lib; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); - this->StartOutputDirectory = - cmSystemTools::CollapseFullPath(this->StartOutputDirectory); - cmSystemTools::MakeDirectory(this->StartOutputDirectory.c_str()); - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->StartOutputDirectory.c_str()); - } - const char* GetStartOutputDirectory() const - { - return this->StartOutputDirectory.c_str(); - } - //@} - - const char* GetCurrentDirectory() const - { - return this->cmStartDirectory.c_str(); - } - const char* GetCurrentOutputDirectory() const - { - return this->StartOutputDirectory.c_str(); - } + void SetCurrentSourceDirectory(const std::string& dir); + const char* GetCurrentSourceDirectory() const; + void SetCurrentBinaryDirectory(const std::string& dir); + const char* GetCurrentBinaryDirectory() const; /* Get the current CMakeLists.txt file that is being processed. This * is just used in order to be able to 'branch' from one file to a second diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index ab58cbd..37b297e 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -108,7 +108,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string outpathImp; if(relink) { - outpath = this->Makefile->GetStartOutputDirectory(); + outpath = this->Makefile->GetCurrentBinaryDirectory(); outpath += cmake::GetCMakeFilesDirectory(); outpath += "/CMakeRelink.dir"; cmSystemTools::MakeDirectory(outpath.c_str()); @@ -419,7 +419,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } this->LocalGenerator->CreateCDCommand (commands1, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); @@ -433,7 +433,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) symlink += targetOutPath; commands1.push_back(symlink); this->LocalGenerator->CreateCDCommand(commands1, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index fcb76c3..c001622 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -286,7 +286,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } else if(relink) { - outpath = this->Makefile->GetStartOutputDirectory(); + outpath = this->Makefile->GetCurrentBinaryDirectory(); outpath += cmake::GetCMakeFilesDirectory(); outpath += "/CMakeRelink.dir"; cmSystemTools::MakeDirectory(outpath.c_str()); @@ -445,7 +445,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules *this->Target, "target"); this->LocalGenerator->CreateCDCommand (commands1, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); @@ -726,7 +726,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } this->LocalGenerator->CreateCDCommand (commands1, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); @@ -743,7 +743,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules symlink += targetOutPath; commands1.push_back(symlink); this->LocalGenerator->CreateCDCommand(commands1, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), commands1.begin(), commands1.end()); commands1.clear(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0076caf..d28dde1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -495,7 +495,7 @@ void cmMakefileTargetGenerator this->WriteObjectBuildFile(obj, lang, source, depends); // The object file should be checked for dependency integrity. - std::string objFullPath = this->Makefile->GetCurrentOutputDirectory(); + std::string objFullPath = this->Makefile->GetCurrentBinaryDirectory(); objFullPath += "/"; objFullPath += obj; objFullPath = @@ -741,7 +741,7 @@ cmMakefileTargetGenerator this->LocalGenerator->ExpandRuleVariables(compileCommand, vars); std::string workingDirectory = this->LocalGenerator->Convert( - this->Makefile->GetStartOutputDirectory(), cmLocalGenerator::FULL); + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::FULL); compileCommand.replace(compileCommand.find(langFlags), langFlags.size(), this->GetFlags(lang)); std::string langDefines = std::string("$(") + lang + "_DEFINES)"; @@ -761,7 +761,7 @@ cmMakefileTargetGenerator // Change the command working directory to the local build tree. this->LocalGenerator->CreateCDCommand (compileCommands, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), compileCommands.begin(), compileCommands.end()); @@ -834,7 +834,7 @@ cmMakefileTargetGenerator this->LocalGenerator->CreateCDCommand (preprocessCommands, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), preprocessCommands.begin(), @@ -891,7 +891,7 @@ cmMakefileTargetGenerator this->LocalGenerator->CreateCDCommand (assemblyCommands, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); commands.insert(commands.end(), assemblyCommands.begin(), @@ -992,7 +992,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() *this->Target); this->LocalGenerator->CreateCDCommand (commands, - this->Makefile->GetStartOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::HOME_OUTPUT); // Write the rule. @@ -1139,7 +1139,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() { cmMakefile* mf = linkee->GetMakefile(); cmLocalGenerator* lg = mf->GetLocalGenerator(); - std::string di = mf->GetStartOutputDirectory(); + std::string di = mf->GetCurrentBinaryDirectory(); di += "/"; di += lg->GetTargetDirectory(*linkee); di += "/DependInfo.cmake"; @@ -1199,13 +1199,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << this->Convert(this->Makefile->GetHomeDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " - << this->Convert(this->Makefile->GetStartDirectory(), + << this->Convert(this->Makefile->GetCurrentSourceDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " << this->Convert(this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " - << this->Convert(this->Makefile->GetStartOutputDirectory(), + << this->Convert(this->Makefile->GetCurrentBinaryDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " << this->Convert(this->InfoFileNameFull, @@ -1968,7 +1968,7 @@ const char* cmMakefileTargetGenerator::GetFortranModuleDirectory() { // Interpret relative to the current output directory. this->FortranModuleDirectory = - this->Makefile->GetCurrentOutputDirectory(); + this->Makefile->GetCurrentBinaryDirectory(); this->FortranModuleDirectory += "/"; this->FortranModuleDirectory += target_mod_dir; } diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 92fccd3..dfd3c04 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -45,7 +45,8 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target) // (i.e. top-level) directory. CMake creates copies of these targets // in every directory, which we don't need. cmMakefile *mf = target->Target->GetMakefile(); - if (strcmp(mf->GetStartDirectory(), mf->GetHomeDirectory()) == 0) + if (strcmp(mf->GetCurrentSourceDirectory(), + mf->GetHomeDirectory()) == 0) return new cmNinjaUtilityTargetGenerator(target); // else fallthrough } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index df531e7..2d57d3b 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -192,7 +192,7 @@ bool cmOutputRequiredFilesCommand // compute the list of files cmLBDepend md; md.SetMakefile(this->Makefile); - md.AddSearchPath(this->Makefile->GetStartDirectory()); + md.AddSearchPath(this->Makefile->GetCurrentSourceDirectory()); // find the depends for a file const cmDependInformation *info = md.FindDependencies(this->File.c_str()); if (info) diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 43b02bc..afacc1b 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -29,20 +29,20 @@ bool cmProjectCommand this->Makefile->AddCacheDefinition (bindir, - this->Makefile->GetCurrentOutputDirectory(), + this->Makefile->GetCurrentBinaryDirectory(), "Value Computed by CMake", cmState::STATIC); this->Makefile->AddCacheDefinition (srcdir, - this->Makefile->GetCurrentDirectory(), + this->Makefile->GetCurrentSourceDirectory(), "Value Computed by CMake", cmState::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; this->Makefile->AddDefinition(bindir, - this->Makefile->GetCurrentOutputDirectory()); + this->Makefile->GetCurrentBinaryDirectory()); this->Makefile->AddDefinition(srcdir, - this->Makefile->GetCurrentDirectory()); + this->Makefile->GetCurrentSourceDirectory()); this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str()); diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 878562c..aae1bb9 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -41,7 +41,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args, // Compute the name of the file to generate. std::string srcName = cmSystemTools::GetFilenameWithoutLastExtension(*j); - std::string newName = this->Makefile->GetCurrentOutputDirectory(); + std::string newName = this->Makefile->GetCurrentBinaryDirectory(); newName += "/moc_"; newName += srcName; newName += ".cxx"; @@ -62,11 +62,11 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& args, { if(curr && curr->GetPropertyAsBool("GENERATED")) { - hname = this->Makefile->GetCurrentOutputDirectory(); + hname = this->Makefile->GetCurrentBinaryDirectory(); } else { - hname = this->Makefile->GetCurrentDirectory(); + hname = this->Makefile->GetCurrentSourceDirectory(); } hname += "/"; hname += *j; diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index 9b92b1e..3adea29 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -46,15 +46,15 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args, // Compute the name of the files to generate. std::string srcName = cmSystemTools::GetFilenameWithoutLastExtension(*j); - std::string hName = this->Makefile->GetCurrentOutputDirectory(); + std::string hName = this->Makefile->GetCurrentBinaryDirectory(); hName += "/"; hName += srcName; hName += ".h"; - std::string cxxName = this->Makefile->GetCurrentOutputDirectory(); + std::string cxxName = this->Makefile->GetCurrentBinaryDirectory(); cxxName += "/"; cxxName += srcName; cxxName += ".cxx"; - std::string mocName = this->Makefile->GetCurrentOutputDirectory(); + std::string mocName = this->Makefile->GetCurrentBinaryDirectory(); mocName += "/moc_"; mocName += srcName; mocName += ".cxx"; @@ -69,11 +69,11 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& args, { if(curr && curr->GetPropertyAsBool("GENERATED")) { - uiName = this->Makefile->GetCurrentOutputDirectory(); + uiName = this->Makefile->GetCurrentBinaryDirectory(); } else { - uiName = this->Makefile->GetCurrentDirectory(); + uiName = this->Makefile->GetCurrentSourceDirectory(); } uiName += "/"; uiName += *j; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 329f9de..1572dc1 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -162,7 +162,7 @@ static std::string getAutogenTargetName(cmTarget const* target) static std::string getAutogenTargetDir(cmTarget const* target) { cmMakefile* makefile = target->GetMakefile(); - std::string targetDir = makefile->GetCurrentOutputDirectory(); + std::string targetDir = makefile->GetCurrentBinaryDirectory(); targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory(); targetDir += "/"; targetDir += getAutogenTargetName(target); @@ -291,7 +291,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) if (target->GetPropertyAsBool("AUTOMOC")) { std::string automocTargetName = getAutogenTargetName(target); - std::string mocCppFile = makefile->GetCurrentOutputDirectory(); + std::string mocCppFile = makefile->GetCurrentBinaryDirectory(); mocCppFile += "/"; mocCppFile += automocTargetName; mocCppFile += ".cpp"; @@ -317,7 +317,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) commandLines.push_back(currentLine); std::string workingDirectory = cmSystemTools::CollapseFullPath( - "", makefile->GetCurrentOutputDirectory()); + "", makefile->GetCurrentBinaryDirectory()); std::vector<std::string> depends; if (const char *autogenDepends = @@ -1199,9 +1199,9 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, cmLocalGenerator* lg = gg->CreateLocalGenerator(); lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory); - lg->GetMakefile()->SetStartOutputDirectory(targetDirectory); + lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); lg->GetMakefile()->SetHomeDirectory(targetDirectory); - lg->GetMakefile()->SetStartDirectory(targetDirectory); + lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg->SetCurrentLocalGenerator(lg); return gg; diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 045c82e..c9cc817 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -86,7 +86,7 @@ void cmSearchPath::AddUserPath(const std::string& path) for(std::vector<std::string>::const_iterator p = outPaths.begin(); p != outPaths.end(); ++p) { - this->AddPathInternal(*p, this->FC->Makefile->GetCurrentDirectory()); + this->AddPathInternal(*p, this->FC->Makefile->GetCurrentSourceDirectory()); } } @@ -104,7 +104,8 @@ void cmSearchPath::AddCMakePath(const std::string& variable) for(std::vector<std::string>::const_iterator p = expanded.begin(); p!= expanded.end(); ++p) { - this->AddPathInternal(*p, this->FC->Makefile->GetCurrentDirectory()); + this->AddPathInternal(*p, + this->FC->Makefile->GetCurrentSourceDirectory()); } } } @@ -132,7 +133,8 @@ void cmSearchPath::AddCMakePrefixPath(const std::string& variable) std::vector<std::string> expanded; cmSystemTools::ExpandListArgument(value, expanded); - this->AddPrefixPaths(expanded, this->FC->Makefile->GetCurrentDirectory()); + this->AddPrefixPaths(expanded, + this->FC->Makefile->GetCurrentSourceDirectory()); } } diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index bb94a72..35262b6 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -197,7 +197,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode() std::string dir = *this->Names.begin(); if(!cmSystemTools::FileIsFullPath(dir.c_str())) { - dir = this->Makefile->GetCurrentDirectory(); + dir = this->Makefile->GetCurrentSourceDirectory(); dir += "/"; dir += *this->Names.begin(); } diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 6847475..cdd04ed 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -162,8 +162,8 @@ bool cmSourceFile::FindFullPath(std::string* error) const char* tryDirs[3] = {0, 0, 0}; if(this->Location.DirectoryIsAmbiguous()) { - tryDirs[0] = mf->GetCurrentDirectory(); - tryDirs[1] = mf->GetCurrentOutputDirectory(); + tryDirs[0] = mf->GetCurrentSourceDirectory(); + tryDirs[1] = mf->GetCurrentBinaryDirectory(); } else { diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx index 9d67c1e..a0eba5e 100644 --- a/Source/cmSourceFileLocation.cxx +++ b/Source/cmSourceFileLocation.cxx @@ -93,7 +93,7 @@ void cmSourceFileLocation::DirectoryUseSource() { this->Directory = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentDirectory()); + this->Directory, this->Makefile->GetCurrentSourceDirectory()); this->AmbiguousDirectory = false; } } @@ -106,7 +106,7 @@ void cmSourceFileLocation::DirectoryUseBinary() { this->Directory = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentOutputDirectory()); + this->Directory, this->Makefile->GetCurrentBinaryDirectory()); this->AmbiguousDirectory = false; } } @@ -143,7 +143,7 @@ void cmSourceFileLocation::UpdateExtension(const std::string& name) // Check the source tree only because a file in the build tree should // be specified by full path at least once. We do not want this // detection to depend on whether the project has already been built. - tryPath = this->Makefile->GetCurrentDirectory(); + tryPath = this->Makefile->GetCurrentSourceDirectory(); tryPath += "/"; } if(!this->Directory.empty()) @@ -282,10 +282,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // Compare possible directory combinations. std::string const& srcDir = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentDirectory()); + this->Directory, this->Makefile->GetCurrentSourceDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( - this->Directory, this->Makefile->GetCurrentOutputDirectory()); + this->Directory, this->Makefile->GetCurrentBinaryDirectory()); if(srcDir != loc.Directory && binDir != loc.Directory) { @@ -297,10 +297,10 @@ bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc) // Compare possible directory combinations. std::string const& srcDir = cmSystemTools::CollapseFullPath( - loc.Directory, loc.Makefile->GetCurrentDirectory()); + loc.Directory, loc.Makefile->GetCurrentSourceDirectory()); std::string const& binDir = cmSystemTools::CollapseFullPath( - loc.Directory, loc.Makefile->GetCurrentOutputDirectory()); + loc.Directory, loc.Makefile->GetCurrentBinaryDirectory()); if(srcDir != this->Directory && binDir != this->Directory) { diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 1741e05..fadb172 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -81,7 +81,7 @@ bool cmSourceGroupCommand std::string src = args[i]; if(!cmSystemTools::FileIsFullPath(src.c_str())) { - src = this->Makefile->GetCurrentDirectory(); + src = this->Makefile->GetCurrentSourceDirectory(); src += "/"; src += args[i]; } diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index 7cb2edc..6a4a835 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -39,12 +39,12 @@ bool cmSubdirCommand // if they specified a relative path then compute the full std::string srcPath = - std::string(this->Makefile->GetCurrentDirectory()) + + std::string(this->Makefile->GetCurrentSourceDirectory()) + "/" + i->c_str(); if (cmSystemTools::FileIsDirectory(srcPath)) { std::string binPath = - std::string(this->Makefile->GetCurrentOutputDirectory()) + + std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + i->c_str(); this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false); @@ -55,7 +55,7 @@ bool cmSubdirCommand // we must compute the binPath from the srcPath, we just take the last // element from the source path and use that std::string binPath = - std::string(this->Makefile->GetCurrentOutputDirectory()) + + std::string(this->Makefile->GetCurrentBinaryDirectory()) + "/" + cmSystemTools::GetFilenameName(*i); this->Makefile->AddSubDirectory(*i, binPath, excludeFromAll, false); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f1540d4..f69e9ae 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -540,7 +540,7 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const //---------------------------------------------------------------------------- std::string cmTarget::GetSupportDirectory() const { - std::string dir = this->Makefile->GetCurrentOutputDirectory(); + std::string dir = this->Makefile->GetCurrentBinaryDirectory(); dir += cmake::GetCMakeFilesDirectory(); dir += "/"; dir += this->Name; @@ -1918,8 +1918,8 @@ void cmTarget::AppendBuildInterfaceIncludes() if (this->Makefile->IsOn("CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE")) { - const char *binDir = this->Makefile->GetStartOutputDirectory(); - const char *srcDir = this->Makefile->GetStartDirectory(); + const char *binDir = this->Makefile->GetCurrentBinaryDirectory(); + const char *srcDir = this->Makefile->GetCurrentSourceDirectory(); const std::string dirs = std::string(binDir ? binDir : "") + std::string(binDir ? ";" : "") + std::string(srcDir ? srcDir : ""); @@ -4542,7 +4542,7 @@ bool cmTarget::ComputeOutputDir(const std::string& config, // specified as a relative path. Treat a relative path as // relative to the current output directory for this makefile. out = (cmSystemTools::CollapseFullPath - (out, this->Makefile->GetStartOutputDirectory())); + (out, this->Makefile->GetCurrentBinaryDirectory())); // The generator may add the configuration's subdirectory. if(!conf.empty()) @@ -4608,7 +4608,7 @@ bool cmTarget::ComputePDBOutputDir(const std::string& kind, // specified as a relative path. Treat a relative path as // relative to the current output directory for this makefile. out = (cmSystemTools::CollapseFullPath - (out, this->Makefile->GetStartOutputDirectory())); + (out, this->Makefile->GetCurrentBinaryDirectory())); // The generator may add the configuration's subdirectory. if(!conf.empty()) diff --git a/Source/cmTargetIncludeDirectoriesCommand.cxx b/Source/cmTargetIncludeDirectoriesCommand.cxx index b638e57..24500db 100644 --- a/Source/cmTargetIncludeDirectoriesCommand.cxx +++ b/Source/cmTargetIncludeDirectoriesCommand.cxx @@ -47,7 +47,8 @@ std::string cmTargetIncludeDirectoriesCommand { std::string dirs; std::string sep; - std::string prefix = this->Makefile->GetStartDirectory() + std::string("/"); + std::string prefix = + this->Makefile->GetCurrentSourceDirectory() + std::string("/"); for(std::vector<std::string>::const_iterator it = content.begin(); it != content.end(); ++it) { diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 10122e9..486328f 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -75,7 +75,7 @@ bool cmUtilitySourceCommand // The third argument specifies the relative directory of the source // of the utility. std::string relativeSource = *arg++; - std::string utilitySource = this->Makefile->GetCurrentDirectory(); + std::string utilitySource = this->Makefile->GetCurrentSourceDirectory(); utilitySource = utilitySource+"/"+relativeSource; // If the directory doesn't exist, the source has not been included. @@ -93,7 +93,7 @@ bool cmUtilitySourceCommand // The source exists. std::string cmakeCFGout = this->Makefile->GetRequiredDefinition("CMAKE_CFG_INTDIR"); - std::string utilityDirectory = this->Makefile->GetCurrentOutputDirectory(); + std::string utilityDirectory = this->Makefile->GetCurrentBinaryDirectory(); std::string exePath; if (this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH")) { diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index dad6f93..131a134 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -194,7 +194,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target, this->BuildFileStream = 0; this->IsMissingFiles = false; this->DefaultArtifactDir = - this->Makefile->GetStartOutputDirectory() + std::string("/") + + this->Makefile->GetCurrentBinaryDirectory() + std::string("/") + this->LocalGenerator->GetTargetDirectory(*this->Target); } @@ -297,7 +297,7 @@ void cmVisualStudio10TargetGenerator::Generate() } } cmMakefile* mf = this->Target->GetMakefile(); - std::string path = mf->GetStartOutputDirectory(); + std::string path = mf->GetCurrentBinaryDirectory(); path += "/"; path += this->Name; path += ".vcxproj"; @@ -927,7 +927,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path, { return forceRelative ? cmSystemTools::RelativePath( - this->Makefile->GetCurrentOutputDirectory(), path.c_str()) + this->Makefile->GetCurrentBinaryDirectory(), path.c_str()) : this->LocalGenerator->Convert(path.c_str(), cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED, @@ -969,7 +969,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() this->AddMissingSourceGroups(groupsUsed, sourceGroups); // Write out group file - std::string path = this->Makefile->GetStartOutputDirectory(); + std::string path = this->Makefile->GetCurrentBinaryDirectory(); path += "/"; path += this->Name; path += ".vcxproj.filters"; @@ -1430,7 +1430,7 @@ void cmVisualStudio10TargetGenerator::WriteSource( std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true); size_t const maxLen = 250; if(sf->GetCustomCommand() || - ((strlen(this->Makefile->GetCurrentOutputDirectory()) + 1 + + ((strlen(this->Makefile->GetCurrentBinaryDirectory()) + 1 + sourceRel.length()) <= maxLen)) { forceRelative = true; @@ -2194,7 +2194,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( { // Look through the sources for AndroidManifest.xml and use // its location as the root source directory. - std::string rootDir = this->Makefile->GetCurrentDirectory(); + std::string rootDir = this->Makefile->GetCurrentSourceDirectory(); { std::vector<cmSourceFile const*> extraSources; this->GeneratorTarget->GetExtraSources(extraSources, ""); @@ -2714,7 +2714,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() } else { - path = mf->GetStartOutputDirectory(); + path = mf->GetCurrentBinaryDirectory(); path += "/"; path += dt->GetName(); path += ".vcxproj"; @@ -2978,7 +2978,7 @@ void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80() // 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 // folders - std::string manifestFile = this->Makefile->GetStartOutputDirectory() + + std::string manifestFile = this->Makefile->GetCurrentBinaryDirectory() + std::string("/WMAppManifest.xml"); std::string artifactDir = this->LocalGenerator->GetTargetDirectory(*this->Target); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d113c9f..439cc54 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -375,11 +375,11 @@ void cmake::ReadListFile(const std::vector<std::string>& args, cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); lg->GetMakefile()->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetStartOutputDirectory + lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetStartDirectory + lg->GetMakefile()->SetCurrentSourceDirectory (cmSystemTools::GetCurrentWorkingDirectory()); if (this->GetWorkingMode() != NORMAL_MODE) { @@ -405,6 +405,11 @@ void cmake::ReadListFile(const std::vector<std::string>& args, bool cmake::FindPackage(const std::vector<std::string>& args) { + this->SetHomeDirectory + (cmSystemTools::GetCurrentWorkingDirectory()); + this->SetHomeOutputDirectory + (cmSystemTools::GetCurrentWorkingDirectory()); + // if a generator was not yet created, temporarily create one cmGlobalGenerator *gg = new cmGlobalGenerator; gg->SetCMakeInstance(this); @@ -413,13 +418,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args) // read in the list file to fill the cache cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); - mf->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetHomeDirectory + mf->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetStartDirectory + mf->SetCurrentSourceDirectory (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetArgcArgv(args); @@ -727,9 +728,6 @@ void cmake::SetArgs(const std::vector<std::string>& args, this->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); } - - this->SetStartDirectory(this->GetHomeDirectory()); - this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); } //---------------------------------------------------------------------------- @@ -800,9 +798,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) if (existingValue) { this->SetHomeOutputDirectory(cachePath); - this->SetStartOutputDirectory(cachePath); this->SetHomeDirectory(existingValue); - this->SetStartDirectory(existingValue); return; } } @@ -812,14 +808,12 @@ void cmake::SetDirectoriesFromFile(const char* arg) if(!listPath.empty()) { this->SetHomeDirectory(listPath); - this->SetStartDirectory(listPath); if(argIsFile) { // Source CMakeLists.txt file given. It was probably dropped // onto the executable in a GUI. Default to an in-source build. this->SetHomeOutputDirectory(listPath); - this->SetStartOutputDirectory(listPath); } else { @@ -827,7 +821,6 @@ void cmake::SetDirectoriesFromFile(const char* arg) // directory as build tree. std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeOutputDirectory(cwd); - this->SetStartOutputDirectory(cwd); } return; } @@ -838,9 +831,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) std::string full = cmSystemTools::CollapseFullPath(arg); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeDirectory(full); - this->SetStartDirectory(full); this->SetHomeOutputDirectory(cwd); - this->SetStartOutputDirectory(cwd); } // at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the @@ -1005,28 +996,6 @@ const char* cmake::GetHomeOutputDirectory() const return this->HomeOutputDirectory.c_str(); } -const char* cmake::GetStartDirectory() const -{ - return this->cmStartDirectory.c_str(); -} - -void cmake::SetStartDirectory(const std::string& dir) -{ - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); -} - -const char* cmake::GetStartOutputDirectory() const -{ - return this->StartOutputDirectory.c_str(); -} - -void cmake::SetStartOutputDirectory(const std::string& dir) -{ - this->StartOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); -} - void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { if(!gg) @@ -1087,7 +1056,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) int cmake::DoPreConfigureChecks() { - // Make sure the Start directory contains a CMakeLists.txt file. + // Make sure the Source directory contains a CMakeLists.txt file. std::string srcList = this->GetHomeDirectory(); srcList += "/CMakeLists.txt"; if(!cmSystemTools::FileExists(srcList.c_str())) @@ -1189,7 +1158,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) } // remove the cache - this->CacheManager->DeleteCache(this->GetStartOutputDirectory()); + this->CacheManager->DeleteCache(this->GetHomeOutputDirectory()); // load the empty cache this->LoadCache(); // restore the changed compilers @@ -1261,7 +1230,7 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry ("CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(), - "Start directory with the top level CMakeLists.txt file for this " + "Source directory with the top level CMakeLists.txt file for this " "project", cmState::INTERNAL); } @@ -1631,12 +1600,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) return 0; } - // If we are doing global generate, we better set start and start - // output directory to the root of the project. - std::string oldstartdir = this->GetStartDirectory(); - std::string oldstartoutputdir = this->GetStartOutputDirectory(); - this->SetStartDirectory(this->GetHomeDirectory()); - this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); int ret = this->Configure(); if (ret || this->GetWorkingMode() != NORMAL_MODE) { @@ -1666,8 +1629,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) { return ret; } - this->SetStartDirectory(oldstartdir); - this->SetStartOutputDirectory(oldstartoutputdir); return ret; } diff --git a/Source/cmake.h b/Source/cmake.h index 352850d..9dd7c31 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -41,7 +41,7 @@ class cmState; * The basic process for a GUI is as follows: * * -# Create a cmake instance - * -# Set the Home & Start directories, generator, and cmake command. this + * -# Set the Home directories, generator, and cmake command. this * can be done using the Set methods or by using SetArgs and passing in * command line arguments. * -# Load the cache by calling LoadCache (duh) @@ -52,7 +52,7 @@ class cmState; * -# Let the user change values and go back to step 5 * -# call Generate - * If your GUI allows the user to change the start & home directories then + * If your GUI allows the user to change the home directories then * you must at a minimum redo steps 2 through 7. */ @@ -106,9 +106,7 @@ class cmake /** * Set/Get the home directory (or output directory) in the project. The * home directory is the top directory of the project. It is the - * path-to-source cmake was run with. Remember that CMake processes - * CMakeLists files by recursing up the tree starting at the StartDirectory - * and going up until it reaches the HomeDirectory. + * path-to-source cmake was run with. */ void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const; @@ -116,20 +114,6 @@ class cmake const char* GetHomeOutputDirectory() const; //@} - //@{ - /** - * Set/Get the start directory (or output directory). The start directory - * is the directory of the CMakeLists.txt file that started the current - * round of processing. Remember that CMake processes CMakeLists files by - * recursing up the tree starting at the StartDirectory and going up until - * it reaches the HomeDirectory. - */ - void SetStartDirectory(const std::string& dir); - const char* GetStartDirectory() const; - void SetStartOutputDirectory(const std::string& dir); - const char* GetStartOutputDirectory() const; - //@} - /** * Handle a command line invocation of cmake. */ @@ -354,8 +338,6 @@ protected: cmCacheManager *CacheManager; std::string cmHomeDirectory; std::string HomeOutputDirectory; - std::string cmStartDirectory; - std::string StartOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; std::string GeneratorPlatform; diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index c8cf2d4..d82087f 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -154,12 +154,12 @@ static void cmakemainProgressCallback(const char *m, float prog, if ((mf) && (strstr(m, "Configuring")==m) && (prog<0)) { dir = " "; - dir += mf->GetCurrentDirectory(); + dir += mf->GetCurrentSourceDirectory(); } else if ((mf) && (strstr(m, "Generating")==m)) { dir = " "; - dir += mf->GetCurrentOutputDirectory(); + dir += mf->GetCurrentBinaryDirectory(); } if ((prog < 0) || (!dir.empty())) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5e56957..12bb8ee 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -642,16 +642,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir); startOutDir = cmSystemTools::CollapseFullPath(startOutDir); cm.SetHomeDirectory(homeDir); - cm.SetStartDirectory(startDir); cm.SetHomeOutputDirectory(homeOutDir); - cm.SetStartOutputDirectory(startOutDir); if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); - lgd->GetMakefile()->SetStartDirectory(startDir); - lgd->GetMakefile()->SetStartOutputDirectory(startOutDir); - lgd->GetMakefile()->MakeStartDirectoriesCurrent(); + lgd->GetMakefile()->SetCurrentSourceDirectory(startDir); + lgd->GetMakefile()->SetCurrentBinaryDirectory(startOutDir); // Actually scan dependencies. return lgd->UpdateDependencies(depInfo.c_str(), |