cmGhsMultiTargetGenerator.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2015 Geoffrey Viola <[email protected]>
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #include "cmGhsMultiTargetGenerator.h"
  11. #include "cmGlobalGhsMultiGenerator.h"
  12. #include "cmLocalGhsMultiGenerator.h"
  13. #include "cmMakefile.h"
  14. #include "cmTarget.h"
  15. #include "cmGeneratedFileStream.h"
  16. #include "cmSourceFile.h"
  17. #include <assert.h>
  18. #include <cmAlgorithms.h>
  19. std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
  20. cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target)
  21. : Target(target->Target)
  22. , GeneratorTarget(target)
  23. , LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>(
  24. target->GetLocalGenerator()))
  25. , Makefile(target->Target->GetMakefile())
  26. , TargetGroup(DetermineIfTargetGroup(target))
  27. , DynamicDownload(false)
  28. {
  29. this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target);
  30. this->RelOutputFileName =
  31. this->RelBuildFilePath + this->Target->GetName() + ".a";
  32. this->RelBuildFileName = this->RelBuildFilePath;
  33. this->RelBuildFileName += this->GetBuildFileName(target->Target);
  34. std::string absPathToRoot = this->GetAbsPathToRoot(target->Target);
  35. absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot);
  36. this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
  37. this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
  38. this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName;
  39. }
  40. cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
  41. {
  42. cmDeleteAll(this->FolderBuildStreams);
  43. }
  44. std::string
  45. cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
  46. {
  47. std::string output;
  48. char const *folderProp = target->GetProperty("FOLDER");
  49. output = NULL == folderProp ? "" : folderProp;
  50. cmSystemTools::ConvertToUnixSlashes(output);
  51. if (!output.empty())
  52. {
  53. output += "/";
  54. }
  55. output += target->GetName() + "/";
  56. return output;
  57. }
  58. std::string
  59. cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target)
  60. {
  61. cmGeneratorTarget* gt = target->GetMakefile()->GetGlobalGenerator()
  62. ->GetGeneratorTarget(target);
  63. return gt->GetLocalGenerator()->GetBinaryDirectory();
  64. }
  65. std::string
  66. cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target)
  67. {
  68. std::string output;
  69. output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target);
  70. output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output);
  71. output += cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
  72. return output;
  73. }
  74. std::string
  75. cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target)
  76. {
  77. std::string output;
  78. output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
  79. output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output);
  80. output += cmGhsMultiTargetGenerator::GetBuildFileName(target);
  81. return output;
  82. }
  83. std::string cmGhsMultiTargetGenerator::GetBuildFileName(const cmTarget *target)
  84. {
  85. std::string output;
  86. output = target->GetName();
  87. output += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
  88. return output;
  89. }
  90. std::string
  91. cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(std::string const &input)
  92. {
  93. std::string output(input);
  94. if (!cmHasLiteralSuffix(output, "/"))
  95. {
  96. output += "/";
  97. }
  98. return output;
  99. }
  100. void cmGhsMultiTargetGenerator::Generate()
  101. {
  102. const std::vector<cmSourceFile *> objectSources = this->GetSources();
  103. if (!objectSources.empty() && this->IncludeThisTarget())
  104. {
  105. if (!cmSystemTools::FileExists(this->AbsBuildFilePath.c_str()))
  106. {
  107. cmSystemTools::MakeDirectory(this->AbsBuildFilePath.c_str());
  108. }
  109. cmGlobalGhsMultiGenerator::Open(std::string(""), this->AbsBuildFileName,
  110. &this->FolderBuildStreams);
  111. cmGlobalGhsMultiGenerator::OpenBuildFileStream(
  112. this->GetFolderBuildStreams());
  113. std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
  114. if (0 == config.length())
  115. {
  116. config = "RELEASE";
  117. }
  118. const std::string language(
  119. this->GeneratorTarget->GetLinkerLanguage(config));
  120. config = cmSystemTools::UpperCase(config);
  121. this->DynamicDownload = this->DetermineIfDynamicDownload(config, language);
  122. if (this->DynamicDownload)
  123. {
  124. *this->GetFolderBuildStreams() << "#component integrity_dynamic_download"
  125. << std::endl;
  126. }
  127. GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), this->GetFolderBuildStreams());
  128. cmGlobalGhsMultiGenerator::WriteDisclaimer(this->GetFolderBuildStreams());
  129. bool const notKernel = this->IsNotKernel(config, language);
  130. this->WriteTypeSpecifics(config, notKernel);
  131. this->SetCompilerFlags(config, language, notKernel);
  132. this->WriteCompilerFlags(config, language);
  133. this->WriteCompilerDefinitions(config, language);
  134. this->WriteIncludes(config, language);
  135. if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE)
  136. {
  137. this->WriteTargetLinkLibraries();
  138. }
  139. this->WriteCustomCommands();
  140. this->WriteSources(objectSources);
  141. }
  142. }
  143. bool cmGhsMultiTargetGenerator::IncludeThisTarget()
  144. {
  145. bool output = true;
  146. char const *excludeFromAll = this->Target->GetProperty("EXCLUDE_FROM_ALL");
  147. if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
  148. '\0' == excludeFromAll[1])
  149. {
  150. output = false;
  151. }
  152. return output;
  153. }
  154. std::vector<cmSourceFile *> cmGhsMultiTargetGenerator::GetSources() const
  155. {
  156. std::vector<cmSourceFile *> output;
  157. std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
  158. this->GeneratorTarget->GetSourceFiles(output, config);
  159. return output;
  160. }
  161. GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const
  162. {
  163. return cmGhsMultiTargetGenerator::GetGpjTag(this->GeneratorTarget);
  164. }
  165. GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(
  166. const cmGeneratorTarget *target)
  167. {
  168. GhsMultiGpj::Types output;
  169. if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target))
  170. {
  171. output = GhsMultiGpj::INTERGRITY_APPLICATION;
  172. }
  173. else if (target->GetType() == cmState::STATIC_LIBRARY)
  174. {
  175. output = GhsMultiGpj::LIBRARY;
  176. }
  177. else
  178. {
  179. output = GhsMultiGpj::PROGRAM;
  180. }
  181. return output;
  182. }
  183. cmGlobalGhsMultiGenerator*
  184. cmGhsMultiTargetGenerator::GetGlobalGenerator() const
  185. {
  186. return static_cast<cmGlobalGhsMultiGenerator *>(
  187. this->LocalGenerator->GetGlobalGenerator());
  188. }
  189. void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string &config,
  190. bool const notKernel)
  191. {
  192. std::string outputDir(this->GetOutputDirectory(config));
  193. std::string outputFilename(this->GetOutputFilename(config));
  194. if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY)
  195. {
  196. *this->GetFolderBuildStreams() << " -o \""
  197. << outputDir << outputFilename << ".a\""
  198. << std::endl;
  199. }
  200. else if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE)
  201. {
  202. if (notKernel && !this->IsTargetGroup())
  203. {
  204. *this->GetFolderBuildStreams() << " -relprog" << std::endl;
  205. }
  206. if (this->IsTargetGroup())
  207. {
  208. *this->GetFolderBuildStreams()
  209. << " -o \"" << outputDir
  210. << outputFilename << ".elf\"" << std::endl;
  211. *this->GetFolderBuildStreams() << " :extraOutputFile=\"" << outputDir
  212. << outputFilename << ".elf.ael\""
  213. << std::endl;
  214. }
  215. else
  216. {
  217. *this->GetFolderBuildStreams() << " -o \""
  218. << outputDir << outputFilename << ".as\""
  219. << std::endl;
  220. }
  221. }
  222. }
  223. void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const &config,
  224. const std::string &language,
  225. bool const notKernel)
  226. {
  227. std::map<std::string, std::string>::iterator i =
  228. this->FlagsByLanguage.find(language);
  229. if (i == this->FlagsByLanguage.end())
  230. {
  231. std::string flags;
  232. const char *lang = language.c_str();
  233. if (notKernel)
  234. {
  235. this->LocalGenerator->AddLanguageFlags(flags, lang, config);
  236. }
  237. else
  238. {
  239. this->LocalGenerator->AddLanguageFlags(
  240. flags, lang + std::string("_GHS_KERNEL"), config);
  241. }
  242. this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget,
  243. lang, config);
  244. this->LocalGenerator->AddVisibilityPresetFlags(flags,
  245. this->GeneratorTarget,
  246. lang);
  247. // Append old-style preprocessor definition flags.
  248. if (std::string(" ") != std::string(this->Makefile->GetDefineFlags()))
  249. {
  250. this->LocalGenerator->AppendFlags(flags,
  251. this->Makefile->GetDefineFlags());
  252. }
  253. // Add target-specific flags.
  254. this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
  255. lang, config);
  256. std::map<std::string, std::string>::value_type entry(language, flags);
  257. i = this->FlagsByLanguage.insert(entry).first;
  258. }
  259. }
  260. std::string cmGhsMultiTargetGenerator::GetDefines(const std::string &language,
  261. std::string const &config)
  262. {
  263. std::map<std::string, std::string>::iterator i =
  264. this->DefinesByLanguage.find(language);
  265. if (i == this->DefinesByLanguage.end())
  266. {
  267. std::set<std::string> defines;
  268. const char *lang = language.c_str();
  269. // Add the export symbol definition for shared library objects.
  270. if (const char *exportMacro = this->GeneratorTarget->GetExportMacro())
  271. {
  272. this->LocalGenerator->AppendDefines(defines, exportMacro);
  273. }
  274. // Add preprocessor definitions for this target and configuration.
  275. this->LocalGenerator->AddCompileDefinitions(defines,
  276. this->GeneratorTarget, config,
  277. language);
  278. std::string definesString;
  279. this->LocalGenerator->JoinDefines(defines, definesString, lang);
  280. std::map<std::string, std::string>::value_type entry(language,
  281. definesString);
  282. i = this->DefinesByLanguage.insert(entry).first;
  283. }
  284. return i->second;
  285. }
  286. void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::string const &,
  287. const std::string &language)
  288. {
  289. std::map<std::string, std::string>::iterator flagsByLangI =
  290. this->FlagsByLanguage.find(language);
  291. if (flagsByLangI != this->FlagsByLanguage.end())
  292. {
  293. if (!flagsByLangI->second.empty())
  294. {
  295. *this->GetFolderBuildStreams() << " " << flagsByLangI->second
  296. << std::endl;
  297. }
  298. }
  299. }
  300. void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
  301. const std::string &config, const std::string &language)
  302. {
  303. std::vector<std::string> compileDefinitions;
  304. this->GeneratorTarget->GetCompileDefinitions(compileDefinitions,
  305. config, language);
  306. for (std::vector<std::string>::const_iterator cdI =
  307. compileDefinitions.begin();
  308. cdI != compileDefinitions.end(); ++cdI)
  309. {
  310. *this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl;
  311. }
  312. }
  313. void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config,
  314. const std::string &language)
  315. {
  316. std::vector<std::string> includes =
  317. this->GeneratorTarget->GetIncludeDirectories(config, language);
  318. for (std::vector<std::string>::const_iterator includes_i = includes.begin();
  319. includes_i != includes.end(); ++includes_i)
  320. {
  321. *this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\""
  322. << std::endl;
  323. }
  324. }
  325. void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
  326. {
  327. // library directories
  328. cmTargetDependSet tds =
  329. this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget);
  330. for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
  331. ++tdsI)
  332. {
  333. const cmTarget *tg = (*tdsI)->Target;
  334. *this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
  335. << "\"" << std::endl;
  336. }
  337. // library targets
  338. cmTarget::LinkLibraryVectorType llv =
  339. this->Target->GetOriginalLinkLibraries();
  340. for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin();
  341. llvI != llv.end(); ++llvI)
  342. {
  343. std::string libName = llvI->first;
  344. // if it is a user defined target get the full path to the lib
  345. cmTarget *tg(GetGlobalGenerator()->FindTarget(libName));
  346. if (NULL != tg)
  347. {
  348. libName = tg->GetName() + ".a";
  349. }
  350. *this->GetFolderBuildStreams() << " -l\"" << libName << "\""
  351. << std::endl;
  352. }
  353. }
  354. void cmGhsMultiTargetGenerator::WriteCustomCommands()
  355. {
  356. WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(),
  357. cmTarget::PRE_BUILD);
  358. WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(),
  359. cmTarget::POST_BUILD);
  360. }
  361. void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
  362. std::vector<cmCustomCommand> const &commandsSet,
  363. cmTarget::CustomCommandType const commandType)
  364. {
  365. for (std::vector<cmCustomCommand>::const_iterator commandsSetI =
  366. commandsSet.begin();
  367. commandsSetI != commandsSet.end(); ++commandsSetI)
  368. {
  369. cmCustomCommandLines const &commands = commandsSetI->GetCommandLines();
  370. for (cmCustomCommandLines::const_iterator commandI = commands.begin();
  371. commandI != commands.end(); ++commandI)
  372. {
  373. switch (commandType)
  374. {
  375. case cmTarget::PRE_BUILD:
  376. *this->GetFolderBuildStreams() << " :preexecShellSafe=";
  377. break;
  378. case cmTarget::POST_BUILD:
  379. *this->GetFolderBuildStreams() << " :postexecShellSafe=";
  380. break;
  381. default:
  382. assert("Only pre and post are supported");
  383. }
  384. cmCustomCommandLine const &command = *commandI;
  385. for (cmCustomCommandLine::const_iterator commandLineI = command.begin();
  386. commandLineI != command.end(); ++commandLineI)
  387. {
  388. std::string subCommandE =
  389. this->LocalGenerator->EscapeForShell(*commandLineI, true);
  390. if (!command.empty())
  391. {
  392. *this->GetFolderBuildStreams()
  393. << (command.begin() == commandLineI ? "'" : " ");
  394. //Need to double escape backslashes
  395. cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\");
  396. }
  397. *this->GetFolderBuildStreams() << subCommandE;
  398. }
  399. if (!command.empty())
  400. {
  401. *this->GetFolderBuildStreams() << "'" << std::endl;
  402. }
  403. }
  404. }
  405. }
  406. void cmGhsMultiTargetGenerator::WriteSources(
  407. std::vector<cmSourceFile *> const &objectSources)
  408. {
  409. for (std::vector<cmSourceFile *>::const_iterator si = objectSources.begin();
  410. si != objectSources.end(); ++si)
  411. {
  412. std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups());
  413. char const *sourceFullPath = (*si)->GetFullPath().c_str();
  414. cmSourceGroup *sourceGroup =
  415. this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
  416. std::string sgPath(sourceGroup->GetFullName());
  417. cmSystemTools::ConvertToUnixSlashes(sgPath);
  418. cmGlobalGhsMultiGenerator::AddFilesUpToPath(
  419. this->GetFolderBuildStreams(), &this->FolderBuildStreams,
  420. this->LocalGenerator->GetBinaryDirectory(), sgPath,
  421. GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
  422. std::string fullSourcePath((*si)->GetFullPath());
  423. if ((*si)->GetExtension() == "int" || (*si)->GetExtension() == "bsp")
  424. {
  425. *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
  426. }
  427. else
  428. {
  429. //WORKAROUND: GHS MULTI needs the path to use backslashes without quotes
  430. // to open files in search as of version 6.1.6
  431. cmsys::SystemTools::ReplaceString(fullSourcePath, "/", "\\");
  432. *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
  433. }
  434. if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() &&
  435. "bsp" != (*si)->GetExtension())
  436. {
  437. this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
  438. this->WriteObjectDir(this->FolderBuildStreams[sgPath],
  439. this->AbsBuildFilePath + sgPath);
  440. }
  441. }
  442. }
  443. void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
  444. cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile)
  445. {
  446. const char *rawLangProp = sourceFile->GetProperty("LANGUAGE");
  447. if (NULL != rawLangProp)
  448. {
  449. std::string sourceLangProp(rawLangProp);
  450. std::string extension(sourceFile->GetExtension());
  451. if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension))
  452. {
  453. *fileStream << " -dotciscxx" << std::endl;
  454. }
  455. }
  456. }
  457. void cmGhsMultiTargetGenerator::WriteObjectDir(
  458. cmGeneratedFileStream *fileStream, std::string const &dir)
  459. {
  460. std::string workingDir(dir);
  461. cmSystemTools::ConvertToUnixSlashes(workingDir);
  462. if (!workingDir.empty())
  463. {
  464. workingDir += "/";
  465. }
  466. workingDir += "Objs";
  467. *fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl;
  468. }
  469. std::string
  470. cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
  471. {
  472. std::string outputDir(AbsBuildFilePath);
  473. const char *runtimeOutputProp =
  474. this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
  475. if (NULL != runtimeOutputProp)
  476. {
  477. outputDir = runtimeOutputProp;
  478. }
  479. std::string configCapped(cmSystemTools::UpperCase(config));
  480. const char *runtimeOutputSProp =
  481. this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
  482. if (NULL != runtimeOutputSProp)
  483. {
  484. outputDir = runtimeOutputSProp;
  485. }
  486. cmSystemTools::ConvertToUnixSlashes(outputDir);
  487. if (!outputDir.empty())
  488. {
  489. outputDir += "/";
  490. }
  491. return outputDir;
  492. }
  493. std::string
  494. cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
  495. {
  496. std::string outputFilename(this->Target->GetName());
  497. const char *outputNameProp = this->Target->GetProperty("OUTPUT_NAME");
  498. if (NULL != outputNameProp)
  499. {
  500. outputFilename = outputNameProp;
  501. }
  502. std::string configCapped(cmSystemTools::UpperCase(config));
  503. const char *outputNameSProp =
  504. this->Target->GetProperty(configCapped + "_OUTPUT_NAME");
  505. if (NULL != outputNameSProp)
  506. {
  507. outputFilename = outputNameSProp;
  508. }
  509. return outputFilename;
  510. }
  511. bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config,
  512. const std::string &language)
  513. {
  514. bool output;
  515. std::vector<std::string> options;
  516. this->GeneratorTarget->GetCompileOptions(options, config, language);
  517. output =
  518. options.end() == std::find(options.begin(), options.end(), "-kernel");
  519. return output;
  520. }
  521. bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(
  522. const cmGeneratorTarget *target)
  523. {
  524. bool output = false;
  525. std::vector<cmSourceFile *> sources;
  526. std::string config =
  527. target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
  528. target->GetSourceFiles(sources, config);
  529. for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin();
  530. sources.end() != sources_i; ++sources_i)
  531. {
  532. if ("int" == (*sources_i)->GetExtension())
  533. {
  534. output = true;
  535. }
  536. }
  537. return output;
  538. }
  539. bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload(
  540. std::string const &config, const std::string &language)
  541. {
  542. std::vector<std::string> options;
  543. bool output = false;
  544. this->GeneratorTarget->GetCompileOptions(options, config, language);
  545. for (std::vector<std::string>::const_iterator options_i = options.begin();
  546. options_i != options.end(); ++options_i)
  547. {
  548. std::string option = *options_i;
  549. if (this->DDOption == option)
  550. {
  551. output = true;
  552. }
  553. }
  554. return output;
  555. }