diff options
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 67 |
1 files changed, 62 insertions, 5 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 2fe763d..f688549 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -203,6 +203,8 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() for(std::vector<std::string>::iterator i = includeDirs.begin(); i != includeDirs.end(); ++i) { + // Note: This path conversion must match that used for + // CMAKE_GENERATED_FILES so that the file names match. infoFileStream << " \"" << this->Convert(i->c_str(),HOME_OUTPUT).c_str() << "\"\n"; } @@ -231,6 +233,30 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << "SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; infoFileStream << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n"; + + // Store the set of available generated files. + infoFileStream + << "\n" + << "# The set of files generated by rules in this directory:\n"; + infoFileStream + << "SET(CMAKE_GENERATED_FILES\n"; + for(std::vector<cmSourceFile*>::const_iterator + i = m_Makefile->GetSourceFiles().begin(); + i != m_Makefile->GetSourceFiles().end(); ++i) + { + cmSourceFile* src = *i; + if(src->GetPropertyAsBool("GENERATED")) + { + // Note: This path conversion must match that used for + // CMAKE_C_INCLUDE_PATH so that the file names match. + infoFileStream + << " \"" + << this->Convert(src->GetFullPath().c_str(), HOME_OUTPUT) + << "\"\n"; + } + } + infoFileStream + << ")\n"; } //---------------------------------------------------------------------------- @@ -546,6 +572,7 @@ cmLocalUnixMakefileGenerator3 std::string objectFile = this->Convert(obj.c_str(),START_OUTPUT,SHELL); // Construct the build message. + std::vector<std::string> no_commands; std::vector<std::string> commands; std::string buildEcho = "Building "; buildEcho += lang; @@ -575,6 +602,22 @@ cmLocalUnixMakefileGenerator3 flags.c_str()); } + // Add dependencies known at CMake time. + std::string relativeObjDeps = relativeObj; + relativeObjDeps += "/depend"; + this->WriteMakeRule(ruleFileStream, 0, + relativeObjDeps.c_str(), depends, no_commands); + depends.clear(); + depends.push_back(relativeObjDeps); + + // Make the target dependency scanning rule include cmake-time-known + // dependencies. The others are handled by the check-build-system + // path. + std::string depMark = this->GetRelativeTargetDirectory(target); + depMark += "/depend.make.mark"; + this->WriteMakeRule(ruleFileStream, 0, + depMark.c_str(), depends, no_commands); + // Write the rule. this->WriteMakeRule(ruleFileStream, 0, relativeObj.c_str(), depends, commands); @@ -583,7 +626,6 @@ cmLocalUnixMakefileGenerator3 // corresponding targets. std::string objectRequires = relativeObj; objectRequires += ".requires"; - std::vector<std::string> no_commands; std::vector<std::string> p_depends; // always provide an empty requires target this->WriteMakeRule(ruleFileStream, 0, @@ -2682,7 +2724,21 @@ cmLocalUnixMakefileGenerator3 return false; } this->WriteDisclaimer(ruleFileStream); - + + // Get the set of generated files. + std::vector<std::string> generatedFilesVec; + if(haveDirectoryInfo) + { + if(const char* generated = mf->GetDefinition("CMAKE_GENERATED_FILES")) + { + cmSystemTools::ExpandListArgument(generated, generatedFilesVec); + } + } + + // Sort for efficient lookup. + std::set<cmStdString> generatedFiles(generatedFilesVec.begin(), + generatedFilesVec.end()); + // for each language we need to scan, scan it const char *langStr = mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES"); std::vector<std::string> langs; @@ -2726,15 +2782,16 @@ cmLocalUnixMakefileGenerator3 includeRegexComplain = complainRegex; } } - + // Create the scanner for this language cmDepends *scanner = 0; if(lang == "C" || lang == "CXX" || lang == "RC") { // TODO: Handle RC (resource files) dependencies correctly. scanner = new cmDependsC(includes, - includeRegexScan.c_str(), - includeRegexComplain.c_str()); + includeRegexScan.c_str(), + includeRegexComplain.c_str(), + generatedFiles); } #ifdef CMAKE_BUILD_WITH_CMAKE else if(lang == "Fortran") |