ENH: fix problem with dependency scanning

This commit is contained in:
Ken Martin 2005-06-07 10:47:28 -04:00
parent 6af66e8b20
commit 749fe26394
2 changed files with 24 additions and 10 deletions

View File

@ -214,7 +214,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile()
i != includeDirs.end(); ++i) i != includeDirs.end(); ++i)
{ {
infoFileStream infoFileStream
<< " \"" << this->Convert(i->c_str(),START_OUTPUT).c_str() << "\"\n"; << " \"" << this->Convert(i->c_str(),HOME_OUTPUT).c_str() << "\"\n";
} }
infoFileStream infoFileStream
<< " )\n"; << " )\n";
@ -453,8 +453,13 @@ cmLocalUnixMakefileGenerator3
cmOStringStream depCmd; cmOStringStream depCmd;
// TODO: Account for source file properties and directory-level // TODO: Account for source file properties and directory-level
// definitions when scanning for dependencies. // definitions when scanning for dependencies.
depCmd << "$(CMAKE_COMMAND) -E cmake_depends \"" depCmd << "$(CMAKE_COMMAND) -E cmake_depends "
<< " \""
<< m_GlobalGenerator->GetName() << "\" " << m_GlobalGenerator->GetName() << "\" "
<< this->Convert(m_Makefile->GetHomeOutputDirectory(),FULL,SHELL)
<< " "
<< this->Convert(m_Makefile->GetStartOutputDirectory(),FULL,SHELL)
<< " "
<< lang << " " << lang << " "
<< relativeObj.c_str() << " " << relativeObj.c_str() << " "
<< this->Convert(source.GetFullPath().c_str(),HOME_OUTPUT,SHELL); << this->Convert(source.GetFullPath().c_str(),HOME_OUTPUT,SHELL);
@ -2601,17 +2606,17 @@ cmLocalUnixMakefileGenerator3
::ScanDependencies(std::vector<std::string> const& args) ::ScanDependencies(std::vector<std::string> const& args)
{ {
// Format of arguments is: // Format of arguments is:
// $(CMAKE_COMMAND), cmake_depends, GeneratorName, <lang>, <obj>, <src> // $(CMAKE_COMMAND), cmake_depends, home_output_dir, start_output_dir, GeneratorName, <lang>, <obj>, <src>
// The caller has ensured that all required arguments exist. // The caller has ensured that all required arguments exist.
// The language for which we are scanning dependencies. // The language for which we are scanning dependencies.
std::string const& lang = args[3]; std::string const& lang = args[5];
// The file to which to write dependencies. // The file to which to write dependencies.
const char* objFile = args[4].c_str(); const char* objFile = args[6].c_str();
// The source file at which to start the scan. // The source file at which to start the scan.
const char* srcFile = args[5].c_str(); const char* srcFile = args[7].c_str();
// Read the directory information file. // Read the directory information file.
cmake cm; cmake cm;
@ -2620,13 +2625,17 @@ cmLocalUnixMakefileGenerator3
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
lg->SetGlobalGenerator(&gg); lg->SetGlobalGenerator(&gg);
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
mf->SetHomeOutputDirectory(args[3].c_str());
mf->SetStartOutputDirectory(args[4].c_str());
bool haveDirectoryInfo = false; bool haveDirectoryInfo = false;
if(mf->ReadListFile(0, "CMakeDirectoryInformation.cmake") && std::string dirInfoFile = args[4];
dirInfoFile += "/CMakeDirectoryInformation.cmake";
if(mf->ReadListFile(0, dirInfoFile.c_str()) &&
!cmSystemTools::GetErrorOccuredFlag()) !cmSystemTools::GetErrorOccuredFlag())
{ {
haveDirectoryInfo = true; haveDirectoryInfo = true;
} }
// Test whether we need to force Unix paths. // Test whether we need to force Unix paths.
if(haveDirectoryInfo) if(haveDirectoryInfo)
{ {
@ -2638,6 +2647,11 @@ cmLocalUnixMakefileGenerator3
} }
} }
} }
else
{
cmSystemTools::Error("Directory Information file not found");
}
// Get the set of include directories. // Get the set of include directories.
std::vector<std::string> includes; std::vector<std::string> includes;

View File

@ -826,7 +826,7 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
} }
// Internal CMake dependency scanning support. // Internal CMake dependency scanning support.
else if (args[1] == "cmake_depends" && args.size() >= 6) else if (args[1] == "cmake_depends" && args.size() >= 8)
{ {
cmake cm; cmake cm;
cmGlobalGenerator *ggd = cm.CreateGlobalGenerator(args[2].c_str()); cmGlobalGenerator *ggd = cm.CreateGlobalGenerator(args[2].c_str());
@ -835,7 +835,7 @@ int cmake::CMakeCommand(std::vector<std::string>& args)
{ {
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->SetGlobalGenerator(ggd); lgd->SetGlobalGenerator(ggd);
return lgd->ScanDependencies(args)? 0 : 1; return lgd->ScanDependencies(args)? 0 : 2;
} }
return 1; return 1;
} }