cmGhsMultiTargetGenerator.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmGhsMultiTargetGenerator.h"
  4. #include "cmComputeLinkInformation.h"
  5. #include "cmGeneratedFileStream.h"
  6. #include "cmGeneratorTarget.h"
  7. #include "cmGlobalGhsMultiGenerator.h"
  8. #include "cmLinkLineComputer.h"
  9. #include "cmLocalGhsMultiGenerator.h"
  10. #include "cmMakefile.h"
  11. #include "cmSourceFile.h"
  12. #include "cmSourceGroup.h"
  13. #include "cmTarget.h"
  14. cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
  15. : GeneratorTarget(target)
  16. , LocalGenerator(
  17. static_cast<cmLocalGhsMultiGenerator*>(target->GetLocalGenerator()))
  18. , Makefile(target->Target->GetMakefile())
  19. , Name(target->GetName())
  20. {
  21. // Store the configuration name that is being used
  22. if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) {
  23. // Use the build type given by the user.
  24. this->ConfigName = config;
  25. } else {
  26. // No configuration type given.
  27. this->ConfigName.clear();
  28. }
  29. }
  30. cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
  31. {
  32. }
  33. void cmGhsMultiTargetGenerator::Generate()
  34. {
  35. // Determine type of target for this project
  36. switch (this->GeneratorTarget->GetType()) {
  37. case cmStateEnums::EXECUTABLE: {
  38. // Get the name of the executable to generate.
  39. std::string targetName;
  40. std::string targetNameImport;
  41. std::string targetNamePDB;
  42. this->GeneratorTarget->GetExecutableNames(
  43. targetName, this->TargetNameReal, targetNameImport, targetNamePDB,
  44. this->ConfigName);
  45. if (cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()) {
  46. this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION;
  47. } else {
  48. this->TagType = GhsMultiGpj::PROGRAM;
  49. }
  50. break;
  51. }
  52. case cmStateEnums::STATIC_LIBRARY: {
  53. std::string targetName;
  54. std::string targetNameSO;
  55. std::string targetNameImport;
  56. std::string targetNamePDB;
  57. this->GeneratorTarget->GetLibraryNames(
  58. targetName, targetNameSO, this->TargetNameReal, targetNameImport,
  59. targetNamePDB, this->ConfigName);
  60. this->TagType = GhsMultiGpj::LIBRARY;
  61. break;
  62. }
  63. case cmStateEnums::SHARED_LIBRARY: {
  64. std::string msg = "add_library(<name> SHARED ...) not supported: ";
  65. msg += this->Name;
  66. cmSystemTools::Message(msg.c_str());
  67. return;
  68. }
  69. case cmStateEnums::OBJECT_LIBRARY: {
  70. std::string targetName;
  71. std::string targetNameSO;
  72. std::string targetNameImport;
  73. std::string targetNamePDB;
  74. this->GeneratorTarget->GetLibraryNames(
  75. targetName, targetNameSO, this->TargetNameReal, targetNameImport,
  76. targetNamePDB, this->ConfigName);
  77. this->TagType = GhsMultiGpj::SUBPROJECT;
  78. break;
  79. }
  80. case cmStateEnums::MODULE_LIBRARY: {
  81. std::string msg = "add_library(<name> MODULE ...) not supported: ";
  82. msg += this->Name;
  83. cmSystemTools::Message(msg.c_str());
  84. return;
  85. }
  86. case cmStateEnums::UTILITY: {
  87. std::string msg = "add_custom_target(<name> ...) not supported: ";
  88. msg += this->Name;
  89. cmSystemTools::Message(msg.c_str());
  90. return;
  91. }
  92. default:
  93. return;
  94. }
  95. // Tell the global generator the name of the project file
  96. this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME",
  97. this->Name.c_str());
  98. this->GeneratorTarget->Target->SetProperty(
  99. "GENERATOR_FILE_NAME_EXT", GhsMultiGpj::GetGpjTag(this->TagType));
  100. this->GenerateTarget();
  101. }
  102. void cmGhsMultiTargetGenerator::GenerateTarget()
  103. {
  104. // Open the filestream in copy-if-different mode.
  105. std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory();
  106. fname += "/";
  107. fname += this->Name;
  108. fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
  109. cmGeneratedFileStream fout(fname.c_str());
  110. fout.SetCopyIfDifferent(true);
  111. this->GetGlobalGenerator()->WriteFileHeader(fout);
  112. GhsMultiGpj::WriteGpjTag(this->TagType, fout);
  113. const std::string language(
  114. this->GeneratorTarget->GetLinkerLanguage(this->ConfigName));
  115. this->WriteTargetSpecifics(fout, this->ConfigName);
  116. this->SetCompilerFlags(this->ConfigName, language);
  117. this->WriteCompilerFlags(fout, this->ConfigName, language);
  118. this->WriteCompilerDefinitions(fout, this->ConfigName, language);
  119. this->WriteIncludes(fout, this->ConfigName, language);
  120. this->WriteTargetLinkLine(fout, this->ConfigName);
  121. this->WriteCustomCommands(fout);
  122. this->WriteSources(fout);
  123. this->WriteReferences(fout);
  124. fout.Close();
  125. }
  126. cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator()
  127. const
  128. {
  129. return static_cast<cmGlobalGhsMultiGenerator*>(
  130. this->LocalGenerator->GetGlobalGenerator());
  131. }
  132. void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
  133. const std::string& config)
  134. {
  135. std::string outpath;
  136. std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory();
  137. if (this->TagType != GhsMultiGpj::SUBPROJECT) {
  138. // set target binary file destination
  139. outpath = this->GeneratorTarget->GetDirectory(config);
  140. outpath = this->LocalGenerator->ConvertToRelativePath(rootpath, outpath);
  141. fout << " :binDirRelative=\"" << outpath << "\"" << std::endl;
  142. fout << " -o \"" << this->TargetNameReal << "\"" << std::endl;
  143. }
  144. // set target object file destination
  145. outpath = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
  146. fout << " :outputDirRelative=\"" << outpath << "\"" << std::endl;
  147. }
  148. void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
  149. const std::string& language)
  150. {
  151. std::map<std::string, std::string>::iterator i =
  152. this->FlagsByLanguage.find(language);
  153. if (i == this->FlagsByLanguage.end()) {
  154. std::string flags;
  155. const char* lang = language.c_str();
  156. this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, lang,
  157. config);
  158. this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
  159. config);
  160. this->LocalGenerator->AddVisibilityPresetFlags(
  161. flags, this->GeneratorTarget, lang);
  162. // Append old-style preprocessor definition flags.
  163. if (this->Makefile->GetDefineFlags() != " ") {
  164. this->LocalGenerator->AppendFlags(flags,
  165. this->Makefile->GetDefineFlags());
  166. }
  167. // Add target-specific flags.
  168. this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang,
  169. config);
  170. std::map<std::string, std::string>::value_type entry(language, flags);
  171. i = this->FlagsByLanguage.insert(entry).first;
  172. }
  173. }
  174. std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
  175. std::string const& config)
  176. {
  177. std::map<std::string, std::string>::iterator i =
  178. this->DefinesByLanguage.find(language);
  179. if (i == this->DefinesByLanguage.end()) {
  180. std::set<std::string> defines;
  181. const char* lang = language.c_str();
  182. // Add preprocessor definitions for this target and configuration.
  183. this->LocalGenerator->GetTargetDefines(this->GeneratorTarget, config,
  184. language, defines);
  185. std::string definesString;
  186. this->LocalGenerator->JoinDefines(defines, definesString, lang);
  187. std::map<std::string, std::string>::value_type entry(language,
  188. definesString);
  189. i = this->DefinesByLanguage.insert(entry).first;
  190. }
  191. return i->second;
  192. }
  193. void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
  194. std::string const&,
  195. const std::string& language)
  196. {
  197. std::map<std::string, std::string>::iterator flagsByLangI =
  198. this->FlagsByLanguage.find(language);
  199. if (flagsByLangI != this->FlagsByLanguage.end()) {
  200. if (!flagsByLangI->second.empty()) {
  201. std::vector<std::string> ghsCompFlags =
  202. cmSystemTools::ParseArguments(flagsByLangI->second.c_str());
  203. for (auto& f : ghsCompFlags) {
  204. fout << " " << f << std::endl;
  205. }
  206. }
  207. }
  208. }
  209. void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
  210. std::ostream& fout, const std::string& config, const std::string& language)
  211. {
  212. std::vector<std::string> compileDefinitions;
  213. this->GeneratorTarget->GetCompileDefinitions(compileDefinitions, config,
  214. language);
  215. for (std::vector<std::string>::const_iterator cdI =
  216. compileDefinitions.begin();
  217. cdI != compileDefinitions.end(); ++cdI) {
  218. fout << " -D" << (*cdI) << std::endl;
  219. }
  220. }
  221. void cmGhsMultiTargetGenerator::WriteIncludes(std::ostream& fout,
  222. const std::string& config,
  223. const std::string& language)
  224. {
  225. std::vector<std::string> includes;
  226. this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
  227. language, config);
  228. for (std::vector<std::string>::const_iterator includes_i = includes.begin();
  229. includes_i != includes.end(); ++includes_i) {
  230. fout << " -I\"" << *includes_i << "\"" << std::endl;
  231. }
  232. }
  233. void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
  234. std::string const& config)
  235. {
  236. if (this->TagType == GhsMultiGpj::INTERGRITY_APPLICATION) {
  237. return;
  238. }
  239. std::string linkLibraries;
  240. std::string flags;
  241. std::string linkFlags;
  242. std::string frameworkPath;
  243. std::string linkPath;
  244. std::unique_ptr<cmLinkLineComputer> linkLineComputer(
  245. this->GetGlobalGenerator()->CreateLinkLineComputer(
  246. this->LocalGenerator,
  247. this->LocalGenerator->GetStateSnapshot().GetDirectory()));
  248. this->LocalGenerator->GetTargetFlags(
  249. linkLineComputer.get(), config, linkLibraries, flags, linkFlags,
  250. frameworkPath, linkPath, this->GeneratorTarget);
  251. // write out link options
  252. std::vector<std::string> lopts =
  253. cmSystemTools::ParseArguments(linkFlags.c_str());
  254. for (auto& l : lopts) {
  255. fout << " " << l << std::endl;
  256. }
  257. // write out link search paths
  258. // must be quoted for paths that contain spaces
  259. std::vector<std::string> lpath =
  260. cmSystemTools::ParseArguments(linkPath.c_str());
  261. for (auto& l : lpath) {
  262. fout << " -L\"" << l << "\"" << std::endl;
  263. }
  264. // write out link libs
  265. // must be quoted for filepaths that contains spaces
  266. std::string cbd = this->LocalGenerator->GetCurrentBinaryDirectory();
  267. std::vector<std::string> llibs =
  268. cmSystemTools::ParseArguments(linkLibraries.c_str());
  269. for (auto& l : llibs) {
  270. if (l.compare(0, 2, "-l") == 0) {
  271. fout << " \"" << l << "\"" << std::endl;
  272. } else {
  273. std::string rl = cmSystemTools::CollapseCombinedPath(cbd, l);
  274. fout << " -l\"" << rl << "\"" << std::endl;
  275. }
  276. }
  277. }
  278. void cmGhsMultiTargetGenerator::WriteCustomCommands(std::ostream& fout)
  279. {
  280. WriteCustomCommandsHelper(fout, this->GeneratorTarget->GetPreBuildCommands(),
  281. cmTarget::PRE_BUILD);
  282. WriteCustomCommandsHelper(
  283. fout, this->GeneratorTarget->GetPostBuildCommands(), cmTarget::POST_BUILD);
  284. }
  285. void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
  286. std::ostream& fout, std::vector<cmCustomCommand> const& commandsSet,
  287. cmTarget::CustomCommandType const commandType)
  288. {
  289. for (std::vector<cmCustomCommand>::const_iterator commandsSetI =
  290. commandsSet.begin();
  291. commandsSetI != commandsSet.end(); ++commandsSetI) {
  292. cmCustomCommandLines const& commands = commandsSetI->GetCommandLines();
  293. for (cmCustomCommandLines::const_iterator commandI = commands.begin();
  294. commandI != commands.end(); ++commandI) {
  295. switch (commandType) {
  296. case cmTarget::PRE_BUILD:
  297. fout << " :preexecShellSafe=";
  298. break;
  299. case cmTarget::POST_BUILD:
  300. fout << " :postexecShellSafe=";
  301. break;
  302. default:
  303. assert("Only pre and post are supported");
  304. }
  305. cmCustomCommandLine const& command = *commandI;
  306. for (cmCustomCommandLine::const_iterator commandLineI = command.begin();
  307. commandLineI != command.end(); ++commandLineI) {
  308. std::string subCommandE =
  309. this->LocalGenerator->EscapeForShell(*commandLineI, true);
  310. if (!command.empty()) {
  311. fout << (command.begin() == commandLineI ? "'" : " ");
  312. // Need to double escape backslashes
  313. cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\");
  314. }
  315. fout << subCommandE;
  316. }
  317. if (!command.empty()) {
  318. fout << "'" << std::endl;
  319. }
  320. }
  321. }
  322. }
  323. void cmGhsMultiTargetGenerator::WriteSourceProperty(std::ostream& fout,
  324. const cmSourceFile* sf,
  325. std::string propName,
  326. std::string propFlag)
  327. {
  328. const char* prop = sf->GetProperty(propName);
  329. if (prop) {
  330. std::vector<std::string> list;
  331. cmSystemTools::ExpandListArgument(prop, list);
  332. for (auto& p : list) {
  333. fout << " " << propFlag << p << std::endl;
  334. }
  335. }
  336. }
  337. void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
  338. {
  339. /* vector of all sources for this target */
  340. std::vector<cmSourceFile*> sources;
  341. this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
  342. /* vector of all groups defined for this target
  343. * -- but the vector is not expanded with sub groups or in any useful order
  344. */
  345. std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
  346. /* for each source file assign it to its group */
  347. std::map<std::string, std::vector<cmSourceFile*>> groupFiles;
  348. std::set<std::string> groupNames;
  349. for (auto& sf : sources) {
  350. cmSourceGroup* sourceGroup =
  351. this->Makefile->FindSourceGroup(sf->GetFullPath(), sourceGroups);
  352. std::string gn = sourceGroup->GetFullName();
  353. groupFiles[gn].push_back(sf);
  354. groupNames.insert(gn);
  355. }
  356. /* list of known groups and the order they are displayed in a project file */
  357. const std::vector<std::string> standardGroups = {
  358. "Header Files", "Source Files", "CMake Rules",
  359. "Object Files", "Object Libraries", "Resources"
  360. };
  361. /* list of groups in the order they are displayed in a project file*/
  362. std::vector<std::string> groupFilesList(groupFiles.size());
  363. /* put the groups in the order they should be listed
  364. * - standard groups first, and then everything else
  365. * in the order used by std::map.
  366. */
  367. int i = 0;
  368. for (const std::string& gn : standardGroups) {
  369. auto n = groupNames.find(gn);
  370. if (n != groupNames.end()) {
  371. groupFilesList[i] = *n;
  372. i += 1;
  373. groupNames.erase(gn);
  374. }
  375. }
  376. { /* catch-all group - is last item */
  377. std::string gn = "";
  378. auto n = groupNames.find(gn);
  379. if (n != groupNames.end()) {
  380. groupFilesList.back() = *n;
  381. groupNames.erase(gn);
  382. }
  383. }
  384. for (auto& n : groupNames) {
  385. groupFilesList[i] = n;
  386. i += 1;
  387. }
  388. /* sort the files within each group */
  389. for (auto& n : groupFilesList) {
  390. std::sort(groupFiles[n].begin(), groupFiles[n].end(),
  391. [](cmSourceFile* l, cmSourceFile* r) {
  392. return l->GetFullPath() < r->GetFullPath();
  393. });
  394. }
  395. /* list of open project files */
  396. std::vector<cmGeneratedFileStream*> gfiles;
  397. /* write files into the proper project file
  398. * -- groups go into main project file
  399. * unless FOLDER property or variable is set.
  400. */
  401. for (auto& sg : groupFilesList) {
  402. std::ostream* fout;
  403. bool useProjectFile =
  404. cmSystemTools::IsOn(
  405. this->GeneratorTarget->GetProperty("GHS_NO_SOURCE_GROUP_FILE")) ||
  406. cmSystemTools::IsOn(
  407. this->Makefile->GetDefinition("GHS_NO_SOURCE_GROUP_FILE"));
  408. if (useProjectFile || sg.empty()) {
  409. fout = &fout_proj;
  410. } else {
  411. // Open the filestream in copy-if-different mode.
  412. std::string gname = sg;
  413. cmsys::SystemTools::ReplaceString(gname, "\\", "_");
  414. std::string lpath =
  415. this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
  416. lpath += "/";
  417. lpath += gname;
  418. lpath += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
  419. std::string fpath = this->LocalGenerator->GetCurrentBinaryDirectory();
  420. fpath += "/";
  421. fpath += lpath;
  422. cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath.c_str());
  423. f->SetCopyIfDifferent(true);
  424. gfiles.push_back(f);
  425. fout = f;
  426. this->GetGlobalGenerator()->WriteFileHeader(*f);
  427. GhsMultiGpj::WriteGpjTag(GhsMultiGpj::SUBPROJECT, *f);
  428. fout_proj << lpath << " ";
  429. GhsMultiGpj::WriteGpjTag(GhsMultiGpj::SUBPROJECT, fout_proj);
  430. }
  431. if (useProjectFile) {
  432. if (sg.empty()) {
  433. *fout << "{comment} Others" << std::endl;
  434. } else {
  435. *fout << "{comment} " << sg << std::endl;
  436. }
  437. }
  438. /* output rule for each source file */
  439. for (const cmSourceFile* si : groupFiles[sg]) {
  440. // Convert filename to native system
  441. // WORKAROUND: GHS MULTI 6.1.4 and 6.1.6 are known to need backslash on
  442. // windows when opening some files from the search window.
  443. std::string fname(si->GetFullPath());
  444. cmSystemTools::ConvertToOutputSlashes(fname);
  445. *fout << fname << std::endl;
  446. if ("ld" != si->GetExtension() && "int" != si->GetExtension() &&
  447. "bsp" != si->GetExtension()) {
  448. this->WriteObjectLangOverride(*fout, si);
  449. }
  450. this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I");
  451. this->WriteSourceProperty(*fout, si, "COMPILE_DEFINITIONS", "-D");
  452. this->WriteSourceProperty(*fout, si, "COMPILE_OPTIONS", "");
  453. /* to avoid clutter in the gui only print out the objectName if it has
  454. * been renamed */
  455. std::string objectName = this->GeneratorTarget->GetObjectName(si);
  456. if (!objectName.empty() &&
  457. this->GeneratorTarget->HasExplicitObjectName(si)) {
  458. *fout << " -o " << objectName << std::endl;
  459. }
  460. }
  461. }
  462. for (cmGeneratedFileStream* f : gfiles) {
  463. f->Close();
  464. }
  465. }
  466. void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
  467. std::ostream& fout, const cmSourceFile* sourceFile)
  468. {
  469. const char* rawLangProp = sourceFile->GetProperty("LANGUAGE");
  470. if (NULL != rawLangProp) {
  471. std::string sourceLangProp(rawLangProp);
  472. std::string extension(sourceFile->GetExtension());
  473. if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) {
  474. fout << " -dotciscxx" << std::endl;
  475. }
  476. }
  477. }
  478. void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout)
  479. {
  480. // This only applies to INTEGRITY Applications
  481. if (this->TagType != GhsMultiGpj::INTERGRITY_APPLICATION) {
  482. return;
  483. }
  484. // Get the targets that this one depends upon
  485. cmTargetDependSet unordered =
  486. this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget);
  487. cmGlobalGhsMultiGenerator::OrderedTargetDependSet ordered(unordered,
  488. this->Name);
  489. for (auto& t : ordered) {
  490. std::string tname = t->GetName();
  491. std::string tpath = t->LocalGenerator->GetCurrentBinaryDirectory();
  492. std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory();
  493. std::string outpath =
  494. this->LocalGenerator->ConvertToRelativePath(rootpath, tpath) + "/" +
  495. tname + "REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION;
  496. fout << outpath;
  497. fout << " ";
  498. GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fout);
  499. // Tell the global generator that a refernce project needs to be created
  500. t->Target->SetProperty("GHS_REFERENCE_PROJECT", "ON");
  501. }
  502. }
  503. bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp(void)
  504. {
  505. const char* p = this->GeneratorTarget->GetProperty("ghs_integrity_app");
  506. if (p) {
  507. return cmSystemTools::IsOn(
  508. this->GeneratorTarget->GetProperty("ghs_integrity_app"));
  509. } else {
  510. std::vector<cmSourceFile*> sources;
  511. this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
  512. for (auto& sf : sources) {
  513. if ("int" == sf->GetExtension()) {
  514. return true;
  515. }
  516. }
  517. return false;
  518. }
  519. }