| 286 | } |
| 287 | |
| 288 | void cmExtraEclipseCDT4Generator::CreateProjectFile() |
| 289 | { |
| 290 | auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0]; |
| 291 | cmMakefile* mf = lg->GetMakefile(); |
| 292 | |
| 293 | std::string const filename = this->HomeOutputDirectory + "/.project"; |
| 294 | |
| 295 | cmGeneratedFileStream fout(filename); |
| 296 | if (!fout) { |
| 297 | return; |
| 298 | } |
| 299 | |
| 300 | std::string compilerId = mf->GetSafeDefinition("CMAKE_C_COMPILER_ID"); |
| 301 | if (compilerId.empty()) // no C compiler, try the C++ compiler: |
| 302 | { |
| 303 | compilerId = mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID"); |
| 304 | } |
| 305 | |
| 306 | cmXMLWriter xml(fout); |
| 307 | |
| 308 | xml.StartDocument("UTF-8"); |
| 309 | xml.StartElement("projectDescription"); |
| 310 | |
| 311 | xml.Element("name", |
| 312 | cmExtraEclipseCDT4Generator::GenerateProjectName( |
| 313 | lg->GetProjectName(), |
| 314 | mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), |
| 315 | cmExtraEclipseCDT4Generator::GetPathBasename( |
| 316 | this->HomeOutputDirectory))); |
| 317 | |
| 318 | xml.Element("comment", ""); |
| 319 | xml.Element("projects", ""); |
| 320 | |
| 321 | xml.StartElement("buildSpec"); |
| 322 | xml.StartElement("buildCommand"); |
| 323 | xml.Element("name", "org.eclipse.cdt.make.core.makeBuilder"); |
| 324 | xml.Element("triggers", "clean,full,incremental,"); |
| 325 | xml.StartElement("arguments"); |
| 326 | |
| 327 | // use clean target |
| 328 | AppendDictionary(xml, "org.eclipse.cdt.make.core.cleanBuildTarget", "clean"); |
| 329 | AppendDictionary(xml, "org.eclipse.cdt.make.core.enableCleanBuild", "true"); |
| 330 | AppendDictionary(xml, "org.eclipse.cdt.make.core.append_environment", |
| 331 | "true"); |
| 332 | AppendDictionary(xml, "org.eclipse.cdt.make.core.stopOnError", "true"); |
| 333 | |
| 334 | // set the make command |
| 335 | AppendDictionary(xml, "org.eclipse.cdt.make.core.enabledIncrementalBuild", |
| 336 | "true"); |
| 337 | AppendDictionary(xml, "org.eclipse.cdt.make.core.build.command", |
| 338 | cmExtraEclipseCDT4Generator::GetEclipsePath( |
| 339 | mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"))); |
| 340 | AppendDictionary(xml, "org.eclipse.cdt.make.core.contents", |
| 341 | "org.eclipse.cdt.make.core.activeConfigSettings"); |
| 342 | AppendDictionary(xml, "org.eclipse.cdt.make.core.build.target.inc", "all"); |
| 343 | AppendDictionary(xml, "org.eclipse.cdt.make.core.build.arguments", |
| 344 | mf->GetSafeDefinition("CMAKE_ECLIPSE_MAKE_ARGUMENTS")); |
| 345 | AppendDictionary( |
no test coverage detected