| 238 | } |
| 239 | |
| 240 | void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() |
| 241 | { |
| 242 | if (this->GlobalSettingIsOn("CMAKE_SUPPRESS_REGENERATION")) { |
| 243 | return; |
| 244 | } |
| 245 | |
| 246 | // Open the output file. This should not be copy-if-different |
| 247 | // because the check-build-system step compares the makefile time to |
| 248 | // see if the build system must be regenerated. |
| 249 | std::string cmakefileName = |
| 250 | cmStrCat(this->GetCMakeInstance()->GetHomeOutputDirectory(), |
| 251 | "/CMakeFiles/Makefile.cmake"); |
| 252 | cmGeneratedFileStream cmakefileStream(cmakefileName); |
| 253 | if (!cmakefileStream) { |
| 254 | return; |
| 255 | } |
| 256 | |
| 257 | std::string makefileName = |
| 258 | cmStrCat(this->GetCMakeInstance()->GetHomeOutputDirectory(), "/Makefile"); |
| 259 | |
| 260 | { |
| 261 | // get a local generator for some useful methods |
| 262 | auto& lg = cm::static_reference_cast<cmLocalUnixMakefileGenerator3>( |
| 263 | this->LocalGenerators[0]); |
| 264 | |
| 265 | // Write the do not edit header. |
| 266 | lg.WriteDisclaimer(cmakefileStream); |
| 267 | } |
| 268 | |
| 269 | // Save the generator name |
| 270 | cmakefileStream << "# The generator used is:\n" |
| 271 | << "set(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() |
| 272 | << "\")\n\n"; |
| 273 | |
| 274 | // for each cmMakefile get its list of dependencies |
| 275 | std::vector<std::string> lfiles; |
| 276 | for (auto const& localGen : this->LocalGenerators) { |
| 277 | // Get the list of files contributing to this generation step. |
| 278 | cm::append(lfiles, localGen->GetMakefile()->GetListFiles()); |
| 279 | } |
| 280 | |
| 281 | cmake* cm = this->GetCMakeInstance(); |
| 282 | if (cm->DoWriteGlobVerifyTarget()) { |
| 283 | lfiles.push_back(cm->GetGlobVerifyScript()); |
| 284 | lfiles.push_back(cm->GetGlobVerifyStamp()); |
| 285 | } |
| 286 | |
| 287 | // Sort the list and remove duplicates. |
| 288 | std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>()); |
| 289 | #if !defined(__VMS) // The Compaq STL on VMS crashes, so accept duplicates. |
| 290 | auto new_end = std::unique(lfiles.begin(), lfiles.end()); |
| 291 | lfiles.erase(new_end, lfiles.end()); |
| 292 | #endif |
| 293 | |
| 294 | { |
| 295 | // reset lg to the first makefile |
| 296 | auto const& lg = cm::static_reference_cast<cmLocalUnixMakefileGenerator3>( |
| 297 | this->LocalGenerators[0]); |
no test coverage detected