cmGhsMultiTargetGenerator.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  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() << " {optgroup=GhsCommonOptions} -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. << " {optgroup=GhsCommonOptions} -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() << " {optgroup=GhsCommonOptions} -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->Target, lang, config);
  243. this->LocalGenerator->AddVisibilityPresetFlags(flags, this->Target, lang);
  244. // Append old-style preprocessor definition flags.
  245. if (std::string(" ") != std::string(this->Makefile->GetDefineFlags()))
  246. {
  247. this->LocalGenerator->AppendFlags(flags,
  248. this->Makefile->GetDefineFlags());
  249. }
  250. // Add target-specific flags.
  251. this->LocalGenerator->AddCompileOptions(flags, this->Target, lang, config);
  252. std::map<std::string, std::string>::value_type entry(language, flags);
  253. i = this->FlagsByLanguage.insert(entry).first;
  254. }
  255. }
  256. std::string cmGhsMultiTargetGenerator::GetDefines(const std::string &language,
  257. std::string const &config)
  258. {
  259. std::map<std::string, std::string>::iterator i =
  260. this->DefinesByLanguage.find(language);
  261. if (i == this->DefinesByLanguage.end())
  262. {
  263. std::set<std::string> defines;
  264. const char *lang = language.c_str();
  265. // Add the export symbol definition for shared library objects.
  266. if (const char *exportMacro = this->Target->GetExportMacro())
  267. {
  268. this->LocalGenerator->AppendDefines(defines, exportMacro);
  269. }
  270. // Add preprocessor definitions for this target and configuration.
  271. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, config,
  272. language);
  273. std::string definesString;
  274. this->LocalGenerator->JoinDefines(defines, definesString, lang);
  275. std::map<std::string, std::string>::value_type entry(language,
  276. definesString);
  277. i = this->DefinesByLanguage.insert(entry).first;
  278. }
  279. return i->second;
  280. }
  281. void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::string const &,
  282. const std::string &language)
  283. {
  284. std::map<std::string, std::string>::iterator flagsByLangI =
  285. this->FlagsByLanguage.find(language);
  286. if (flagsByLangI != this->FlagsByLanguage.end())
  287. {
  288. if (!flagsByLangI->second.empty())
  289. {
  290. *this->GetFolderBuildStreams() << " " << flagsByLangI->second
  291. << std::endl;
  292. }
  293. }
  294. }
  295. void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
  296. const std::string &config, const std::string &language)
  297. {
  298. std::vector<std::string> compileDefinitions;
  299. this->GeneratorTarget->GetCompileDefinitions(compileDefinitions,
  300. config, language);
  301. for (std::vector<std::string>::const_iterator cdI =
  302. compileDefinitions.begin();
  303. cdI != compileDefinitions.end(); ++cdI)
  304. {
  305. *this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl;
  306. }
  307. }
  308. void cmGhsMultiTargetGenerator::WriteIncludes(const std::string &config,
  309. const std::string &language)
  310. {
  311. std::vector<std::string> includes =
  312. this->GeneratorTarget->GetIncludeDirectories(config, language);
  313. for (std::vector<std::string>::const_iterator includes_i = includes.begin();
  314. includes_i != includes.end(); ++includes_i)
  315. {
  316. *this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\""
  317. << std::endl;
  318. }
  319. }
  320. void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
  321. {
  322. // library directories
  323. cmTargetDependSet tds =
  324. this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget);
  325. for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
  326. ++tdsI)
  327. {
  328. const cmTarget *tg = (*tdsI)->Target;
  329. *this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
  330. << "\"" << std::endl;
  331. }
  332. // library targets
  333. cmTarget::LinkLibraryVectorType llv =
  334. this->Target->GetOriginalLinkLibraries();
  335. for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin();
  336. llvI != llv.end(); ++llvI)
  337. {
  338. std::string libName = llvI->first;
  339. // if it is a user defined target get the full path to the lib
  340. cmTarget *tg(GetGlobalGenerator()->FindTarget(libName));
  341. if (NULL != tg)
  342. {
  343. libName = tg->GetName() + ".a";
  344. }
  345. *this->GetFolderBuildStreams() << " -l\"" << libName << "\""
  346. << std::endl;
  347. }
  348. }
  349. void cmGhsMultiTargetGenerator::WriteCustomCommands()
  350. {
  351. WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(),
  352. cmTarget::PRE_BUILD);
  353. WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(),
  354. cmTarget::POST_BUILD);
  355. }
  356. void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
  357. std::vector<cmCustomCommand> const &commandsSet,
  358. cmTarget::CustomCommandType const commandType)
  359. {
  360. for (std::vector<cmCustomCommand>::const_iterator commandsSetI =
  361. commandsSet.begin();
  362. commandsSetI != commandsSet.end(); ++commandsSetI)
  363. {
  364. cmCustomCommandLines const &commands = commandsSetI->GetCommandLines();
  365. for (cmCustomCommandLines::const_iterator commandI = commands.begin();
  366. commandI != commands.end(); ++commandI)
  367. {
  368. switch (commandType)
  369. {
  370. case cmTarget::PRE_BUILD:
  371. *this->GetFolderBuildStreams() << " :preexecShellSafe=";
  372. break;
  373. case cmTarget::POST_BUILD:
  374. *this->GetFolderBuildStreams() << " :postexecShellSafe=";
  375. break;
  376. default:
  377. assert("Only pre and post are supported");
  378. }
  379. cmCustomCommandLine const &command = *commandI;
  380. for (cmCustomCommandLine::const_iterator commandLineI = command.begin();
  381. commandLineI != command.end(); ++commandLineI)
  382. {
  383. std::string subCommandE =
  384. this->LocalGenerator->EscapeForShell(*commandLineI, true);
  385. if (!command.empty())
  386. {
  387. *this->GetFolderBuildStreams()
  388. << (command.begin() == commandLineI ? "'" : " ");
  389. //Need to double escape backslashes
  390. cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\");
  391. }
  392. *this->GetFolderBuildStreams() << subCommandE;
  393. }
  394. if (!command.empty())
  395. {
  396. *this->GetFolderBuildStreams() << "'" << std::endl;
  397. }
  398. }
  399. }
  400. }
  401. void cmGhsMultiTargetGenerator::WriteSources(
  402. std::vector<cmSourceFile *> const &objectSources)
  403. {
  404. for (std::vector<cmSourceFile *>::const_iterator si = objectSources.begin();
  405. si != objectSources.end(); ++si)
  406. {
  407. std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups());
  408. char const *sourceFullPath = (*si)->GetFullPath().c_str();
  409. cmSourceGroup *sourceGroup =
  410. this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
  411. std::string sgPath(sourceGroup->GetFullName());
  412. cmSystemTools::ConvertToUnixSlashes(sgPath);
  413. cmGlobalGhsMultiGenerator::AddFilesUpToPath(
  414. this->GetFolderBuildStreams(), &this->FolderBuildStreams,
  415. this->LocalGenerator->GetBinaryDirectory(), sgPath,
  416. GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
  417. std::string fullSourcePath((*si)->GetFullPath());
  418. if ((*si)->GetExtension() == "int" || (*si)->GetExtension() == "bsp")
  419. {
  420. *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
  421. }
  422. else
  423. {
  424. //WORKAROUND: GHS MULTI needs the path to use backslashes without quotes
  425. // to open files in search as of version 6.1.6
  426. cmsys::SystemTools::ReplaceString(fullSourcePath, "/", "\\");
  427. *this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
  428. }
  429. if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() &&
  430. "bsp" != (*si)->GetExtension())
  431. {
  432. this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
  433. this->WriteObjectDir(this->FolderBuildStreams[sgPath],
  434. this->AbsBuildFilePath + sgPath);
  435. }
  436. }
  437. }
  438. void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
  439. cmGeneratedFileStream *fileStream, cmSourceFile *sourceFile)
  440. {
  441. const char *rawLangProp = sourceFile->GetProperty("LANGUAGE");
  442. if (NULL != rawLangProp)
  443. {
  444. std::string sourceLangProp(rawLangProp);
  445. std::string extension(sourceFile->GetExtension());
  446. if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension))
  447. {
  448. *fileStream << " -dotciscxx" << std::endl;
  449. }
  450. }
  451. }
  452. void cmGhsMultiTargetGenerator::WriteObjectDir(
  453. cmGeneratedFileStream *fileStream, std::string const &dir)
  454. {
  455. std::string workingDir(dir);
  456. cmSystemTools::ConvertToUnixSlashes(workingDir);
  457. if (!workingDir.empty())
  458. {
  459. workingDir += "/";
  460. }
  461. workingDir += "Objs";
  462. *fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl;
  463. }
  464. std::string
  465. cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
  466. {
  467. std::string outputDir(AbsBuildFilePath);
  468. const char *runtimeOutputProp =
  469. this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
  470. if (NULL != runtimeOutputProp)
  471. {
  472. outputDir = runtimeOutputProp;
  473. }
  474. std::string configCapped(cmSystemTools::UpperCase(config));
  475. const char *runtimeOutputSProp =
  476. this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
  477. if (NULL != runtimeOutputSProp)
  478. {
  479. outputDir = runtimeOutputSProp;
  480. }
  481. cmSystemTools::ConvertToUnixSlashes(outputDir);
  482. if (!outputDir.empty())
  483. {
  484. outputDir += "/";
  485. }
  486. return outputDir;
  487. }
  488. std::string
  489. cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
  490. {
  491. std::string outputFilename(this->Target->GetName());
  492. const char *outputNameProp = this->Target->GetProperty("OUTPUT_NAME");
  493. if (NULL != outputNameProp)
  494. {
  495. outputFilename = outputNameProp;
  496. }
  497. std::string configCapped(cmSystemTools::UpperCase(config));
  498. const char *outputNameSProp =
  499. this->Target->GetProperty(configCapped + "_OUTPUT_NAME");
  500. if (NULL != outputNameSProp)
  501. {
  502. outputFilename = outputNameSProp;
  503. }
  504. return outputFilename;
  505. }
  506. bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const &config,
  507. const std::string &language)
  508. {
  509. bool output;
  510. std::vector<std::string> options;
  511. this->GeneratorTarget->GetCompileOptions(options, config, language);
  512. output =
  513. options.end() == std::find(options.begin(), options.end(), "-kernel");
  514. return output;
  515. }
  516. bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(
  517. const cmGeneratorTarget *target)
  518. {
  519. bool output = false;
  520. std::vector<cmSourceFile *> sources;
  521. std::string config =
  522. target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
  523. target->GetSourceFiles(sources, config);
  524. for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin();
  525. sources.end() != sources_i; ++sources_i)
  526. {
  527. if ("int" == (*sources_i)->GetExtension())
  528. {
  529. output = true;
  530. }
  531. }
  532. return output;
  533. }
  534. bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload(
  535. std::string const &config, const std::string &language)
  536. {
  537. std::vector<std::string> options;
  538. bool output = false;
  539. this->GeneratorTarget->GetCompileOptions(options, config, language);
  540. for (std::vector<std::string>::const_iterator options_i = options.begin();
  541. options_i != options.end(); ++options_i)
  542. {
  543. std::string option = *options_i;
  544. if (this->DDOption == option)
  545. {
  546. output = true;
  547. }
  548. }
  549. return output;
  550. }