cmExportFileGenerator.cxx 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  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 "cmExportFileGenerator.h"
  11. #include "cmExportSet.h"
  12. #include "cmGeneratedFileStream.h"
  13. #include "cmGlobalGenerator.h"
  14. #include "cmInstallExportGenerator.h"
  15. #include "cmLocalGenerator.h"
  16. #include "cmMakefile.h"
  17. #include "cmSystemTools.h"
  18. #include "cmTarget.h"
  19. #include "cmTargetExport.h"
  20. #include "cmVersion.h"
  21. #include "cmComputeLinkInformation.h"
  22. #include "cmAlgorithms.h"
  23. #include "cmOutputConverter.h"
  24. #include <cmsys/auto_ptr.hxx>
  25. #include <cmsys/FStream.hxx>
  26. #include <assert.h>
  27. //----------------------------------------------------------------------------
  28. static std::string cmExportFileGeneratorEscape(std::string const& str)
  29. {
  30. // Escape a property value for writing into a .cmake file.
  31. std::string result = cmOutputConverter::EscapeForCMake(str);
  32. // Un-escape variable references generated by our own export code.
  33. cmSystemTools::ReplaceString(result,
  34. "\\${_IMPORT_PREFIX}",
  35. "${_IMPORT_PREFIX}");
  36. cmSystemTools::ReplaceString(result,
  37. "\\${CMAKE_IMPORT_LIBRARY_SUFFIX}",
  38. "${CMAKE_IMPORT_LIBRARY_SUFFIX}");
  39. return result;
  40. }
  41. //----------------------------------------------------------------------------
  42. cmExportFileGenerator::cmExportFileGenerator()
  43. {
  44. this->AppendMode = false;
  45. this->ExportOld = false;
  46. }
  47. //----------------------------------------------------------------------------
  48. void cmExportFileGenerator::AddConfiguration(const std::string& config)
  49. {
  50. this->Configurations.push_back(config);
  51. }
  52. //----------------------------------------------------------------------------
  53. void cmExportFileGenerator::SetExportFile(const char* mainFile)
  54. {
  55. this->MainImportFile = mainFile;
  56. this->FileDir =
  57. cmSystemTools::GetFilenamePath(this->MainImportFile);
  58. this->FileBase =
  59. cmSystemTools::GetFilenameWithoutLastExtension(this->MainImportFile);
  60. this->FileExt =
  61. cmSystemTools::GetFilenameLastExtension(this->MainImportFile);
  62. }
  63. //----------------------------------------------------------------------------
  64. const char* cmExportFileGenerator::GetMainExportFileName() const
  65. {
  66. return this->MainImportFile.c_str();
  67. }
  68. //----------------------------------------------------------------------------
  69. bool cmExportFileGenerator::GenerateImportFile()
  70. {
  71. // Open the output file to generate it.
  72. cmsys::auto_ptr<cmsys::ofstream> foutPtr;
  73. if(this->AppendMode)
  74. {
  75. // Open for append.
  76. cmsys::auto_ptr<cmsys::ofstream>
  77. ap(new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app));
  78. foutPtr = ap;
  79. }
  80. else
  81. {
  82. // Generate atomically and with copy-if-different.
  83. cmsys::auto_ptr<cmGeneratedFileStream>
  84. ap(new cmGeneratedFileStream(this->MainImportFile.c_str(), true));
  85. ap->SetCopyIfDifferent(true);
  86. foutPtr = ap;
  87. }
  88. if(!foutPtr.get() || !*foutPtr)
  89. {
  90. std::string se = cmSystemTools::GetLastSystemError();
  91. std::ostringstream e;
  92. e << "cannot write to file \"" << this->MainImportFile
  93. << "\": " << se;
  94. cmSystemTools::Error(e.str().c_str());
  95. return false;
  96. }
  97. std::ostream& os = *foutPtr;
  98. // Protect that file against use with older CMake versions.
  99. os << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n";
  100. os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n"
  101. << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n"
  102. << "endif()\n";
  103. // Isolate the file policy level.
  104. // We use 2.6 here instead of the current version because newer
  105. // versions of CMake should be able to export files imported by 2.6
  106. // until the import format changes.
  107. os << "cmake_policy(PUSH)\n"
  108. << "cmake_policy(VERSION 2.6)\n";
  109. // Start with the import file header.
  110. this->GenerateImportHeaderCode(os);
  111. // Create all the imported targets.
  112. bool result = this->GenerateMainFile(os);
  113. // End with the import file footer.
  114. this->GenerateImportFooterCode(os);
  115. os << "cmake_policy(POP)\n";
  116. return result;
  117. }
  118. //----------------------------------------------------------------------------
  119. void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
  120. const std::string& config,
  121. std::vector<std::string> &missingTargets)
  122. {
  123. // Construct the property configuration suffix.
  124. std::string suffix = "_";
  125. if(!config.empty())
  126. {
  127. suffix += cmSystemTools::UpperCase(config);
  128. }
  129. else
  130. {
  131. suffix += "NOCONFIG";
  132. }
  133. // Generate the per-config target information.
  134. this->GenerateImportTargetsConfig(os, config, suffix, missingTargets);
  135. }
  136. //----------------------------------------------------------------------------
  137. void cmExportFileGenerator::PopulateInterfaceProperty(
  138. const std::string& propName,
  139. cmTarget *target,
  140. ImportPropertyMap &properties)
  141. {
  142. const char *input = target->GetProperty(propName);
  143. if (input)
  144. {
  145. properties[propName] = input;
  146. }
  147. }
  148. //----------------------------------------------------------------------------
  149. void cmExportFileGenerator::PopulateInterfaceProperty(
  150. const std::string& propName,
  151. const std::string& outputName,
  152. cmTarget *target,
  153. cmGeneratorExpression::PreprocessContext preprocessRule,
  154. ImportPropertyMap &properties,
  155. std::vector<std::string> &missingTargets)
  156. {
  157. const char *input = target->GetProperty(propName);
  158. if (input)
  159. {
  160. if (!*input)
  161. {
  162. // Set to empty
  163. properties[outputName] = "";
  164. return;
  165. }
  166. std::string prepro = cmGeneratorExpression::Preprocess(input,
  167. preprocessRule);
  168. if (!prepro.empty())
  169. {
  170. this->ResolveTargetsInGeneratorExpressions(prepro, target,
  171. missingTargets);
  172. properties[outputName] = prepro;
  173. }
  174. }
  175. }
  176. void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
  177. const char *versionString)
  178. {
  179. os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n"
  180. " message(FATAL_ERROR \"This file relies on consumers using "
  181. "CMake " << versionString << " or greater.\")\n"
  182. "endif()\n\n";
  183. }
  184. //----------------------------------------------------------------------------
  185. bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
  186. cmTarget *target,
  187. cmGeneratorExpression::PreprocessContext preprocessRule,
  188. ImportPropertyMap &properties,
  189. std::vector<std::string> &missingTargets)
  190. {
  191. if(!target->IsLinkable())
  192. {
  193. return false;
  194. }
  195. const char *input = target->GetProperty("INTERFACE_LINK_LIBRARIES");
  196. if (input)
  197. {
  198. std::string prepro = cmGeneratorExpression::Preprocess(input,
  199. preprocessRule);
  200. if (!prepro.empty())
  201. {
  202. this->ResolveTargetsInGeneratorExpressions(prepro, target,
  203. missingTargets,
  204. ReplaceFreeTargets);
  205. properties["INTERFACE_LINK_LIBRARIES"] = prepro;
  206. return true;
  207. }
  208. }
  209. return false;
  210. }
  211. //----------------------------------------------------------------------------
  212. static bool isSubDirectory(const char* a, const char* b)
  213. {
  214. return (cmSystemTools::ComparePath(a, b) ||
  215. cmSystemTools::IsSubDirectory(a, b));
  216. }
  217. //----------------------------------------------------------------------------
  218. static bool checkInterfaceDirs(const std::string &prepro,
  219. cmGeneratorTarget *target, const std::string& prop)
  220. {
  221. const char* installDir =
  222. target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
  223. const char* topSourceDir =
  224. target->GetLocalGenerator()->GetSourceDirectory();
  225. const char* topBinaryDir =
  226. target->GetLocalGenerator()->GetBinaryDirectory();
  227. std::vector<std::string> parts;
  228. cmGeneratorExpression::Split(prepro, parts);
  229. const bool inSourceBuild = strcmp(topSourceDir, topBinaryDir) == 0;
  230. bool hadFatalError = false;
  231. for(std::vector<std::string>::iterator li = parts.begin();
  232. li != parts.end(); ++li)
  233. {
  234. size_t genexPos = cmGeneratorExpression::Find(*li);
  235. if (genexPos == 0)
  236. {
  237. continue;
  238. }
  239. cmake::MessageType messageType = cmake::FATAL_ERROR;
  240. std::ostringstream e;
  241. if (genexPos != std::string::npos)
  242. {
  243. if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
  244. {
  245. switch (target->Target->GetPolicyStatusCMP0041())
  246. {
  247. case cmPolicies::WARN:
  248. messageType = cmake::WARNING;
  249. e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0041) << "\n";
  250. break;
  251. case cmPolicies::OLD:
  252. continue;
  253. case cmPolicies::REQUIRED_IF_USED:
  254. case cmPolicies::REQUIRED_ALWAYS:
  255. case cmPolicies::NEW:
  256. hadFatalError = true;
  257. break; // Issue fatal message.
  258. }
  259. }
  260. else
  261. {
  262. hadFatalError = true;
  263. }
  264. }
  265. if (cmHasLiteralPrefix(li->c_str(), "${_IMPORT_PREFIX}"))
  266. {
  267. continue;
  268. }
  269. if (!cmSystemTools::FileIsFullPath(li->c_str()))
  270. {
  271. e << "Target \"" << target->GetName() << "\" " << prop <<
  272. " property contains relative path:\n"
  273. " \"" << *li << "\"";
  274. target->GetLocalGenerator()->IssueMessage(messageType, e.str());
  275. }
  276. bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
  277. bool inSource = isSubDirectory(li->c_str(), topSourceDir);
  278. if (isSubDirectory(li->c_str(), installDir))
  279. {
  280. // The include directory is inside the install tree. If the
  281. // install tree is not inside the source tree or build tree then
  282. // fall through to the checks below that the include directory is not
  283. // also inside the source tree or build tree.
  284. bool shouldContinue =
  285. (!inBinary || isSubDirectory(installDir, topBinaryDir)) &&
  286. (!inSource || isSubDirectory(installDir, topSourceDir));
  287. if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
  288. {
  289. if (!shouldContinue)
  290. {
  291. switch(target->Target->GetPolicyStatusCMP0052())
  292. {
  293. case cmPolicies::WARN:
  294. {
  295. std::ostringstream s;
  296. s << cmPolicies::GetPolicyWarning(cmPolicies::CMP0052) << "\n";
  297. s << "Directory:\n \"" << *li << "\"\nin "
  298. "INTERFACE_INCLUDE_DIRECTORIES of target \""
  299. << target->GetName() << "\" is a subdirectory of the install "
  300. "directory:\n \"" << installDir << "\"\nhowever it is also "
  301. "a subdirectory of the " << (inBinary ? "build" : "source")
  302. << " tree:\n \"" << (inBinary ? topBinaryDir : topSourceDir)
  303. << "\"" << std::endl;
  304. target->GetLocalGenerator()->IssueMessage(cmake::AUTHOR_WARNING,
  305. s.str());
  306. }
  307. case cmPolicies::OLD:
  308. shouldContinue = true;
  309. break;
  310. case cmPolicies::REQUIRED_ALWAYS:
  311. case cmPolicies::REQUIRED_IF_USED:
  312. case cmPolicies::NEW:
  313. break;
  314. }
  315. }
  316. }
  317. if (shouldContinue)
  318. {
  319. continue;
  320. }
  321. }
  322. if (inBinary)
  323. {
  324. e << "Target \"" << target->GetName() << "\" " << prop <<
  325. " property contains path:\n"
  326. " \"" << *li << "\"\nwhich is prefixed in the build directory.";
  327. target->GetLocalGenerator()->IssueMessage(messageType, e.str());
  328. }
  329. if (!inSourceBuild)
  330. {
  331. if (inSource)
  332. {
  333. e << "Target \"" << target->GetName() << "\" " << prop <<
  334. " property contains path:\n"
  335. " \"" << *li << "\"\nwhich is prefixed in the source directory.";
  336. target->GetLocalGenerator()->IssueMessage(messageType, e.str());
  337. }
  338. }
  339. }
  340. return !hadFatalError;
  341. }
  342. //----------------------------------------------------------------------------
  343. static void prefixItems(std::string &exportDirs)
  344. {
  345. std::vector<std::string> entries;
  346. cmGeneratorExpression::Split(exportDirs, entries);
  347. exportDirs = "";
  348. const char *sep = "";
  349. for(std::vector<std::string>::const_iterator ei = entries.begin();
  350. ei != entries.end(); ++ei)
  351. {
  352. exportDirs += sep;
  353. sep = ";";
  354. if (!cmSystemTools::FileIsFullPath(ei->c_str())
  355. && ei->find("${_IMPORT_PREFIX}") == std::string::npos)
  356. {
  357. exportDirs += "${_IMPORT_PREFIX}/";
  358. }
  359. exportDirs += *ei;
  360. }
  361. }
  362. //----------------------------------------------------------------------------
  363. void cmExportFileGenerator::PopulateSourcesInterface(
  364. cmTargetExport *tei,
  365. cmGeneratorExpression::PreprocessContext preprocessRule,
  366. ImportPropertyMap &properties,
  367. std::vector<std::string> &missingTargets)
  368. {
  369. cmTarget *target = tei->Target;
  370. assert(preprocessRule == cmGeneratorExpression::InstallInterface);
  371. const char *propName = "INTERFACE_SOURCES";
  372. const char *input = target->GetProperty(propName);
  373. if (!input)
  374. {
  375. return;
  376. }
  377. if (!*input)
  378. {
  379. properties[propName] = "";
  380. return;
  381. }
  382. std::string prepro = cmGeneratorExpression::Preprocess(input,
  383. preprocessRule,
  384. true);
  385. if (!prepro.empty())
  386. {
  387. this->ResolveTargetsInGeneratorExpressions(prepro, target,
  388. missingTargets);
  389. cmGeneratorTarget* gt = target->GetMakefile()
  390. ->GetGlobalGenerator()->GetGeneratorTarget(target);
  391. if (!checkInterfaceDirs(prepro, gt, propName))
  392. {
  393. return;
  394. }
  395. properties[propName] = prepro;
  396. }
  397. }
  398. //----------------------------------------------------------------------------
  399. void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
  400. cmTargetExport *tei,
  401. cmGeneratorExpression::PreprocessContext preprocessRule,
  402. ImportPropertyMap &properties,
  403. std::vector<std::string> &missingTargets)
  404. {
  405. cmGeneratorTarget *target = tei->Target->GetMakefile()
  406. ->GetGlobalGenerator()
  407. ->GetGeneratorTarget(tei->Target);
  408. assert(preprocessRule == cmGeneratorExpression::InstallInterface);
  409. const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
  410. const char *input = target->GetProperty(propName);
  411. cmGeneratorExpression ge;
  412. std::string dirs = cmGeneratorExpression::Preprocess(
  413. tei->InterfaceIncludeDirectories,
  414. preprocessRule,
  415. true);
  416. this->ReplaceInstallPrefix(dirs);
  417. cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
  418. std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "",
  419. false, target);
  420. if (cge->GetHadContextSensitiveCondition())
  421. {
  422. cmMakefile* mf = target->Target->GetMakefile();
  423. std::ostringstream e;
  424. e << "Target \"" << target->GetName() << "\" is installed with "
  425. "INCLUDES DESTINATION set to a context sensitive path. Paths which "
  426. "depend on the configuration, policy values or the link interface are "
  427. "not supported. Consider using target_include_directories instead.";
  428. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  429. return;
  430. }
  431. if (!input && exportDirs.empty())
  432. {
  433. return;
  434. }
  435. if ((input && !*input) && exportDirs.empty())
  436. {
  437. // Set to empty
  438. properties[propName] = "";
  439. return;
  440. }
  441. prefixItems(exportDirs);
  442. std::string includes = (input?input:"");
  443. const char* sep = input ? ";" : "";
  444. includes += sep + exportDirs;
  445. std::string prepro = cmGeneratorExpression::Preprocess(includes,
  446. preprocessRule,
  447. true);
  448. if (!prepro.empty())
  449. {
  450. this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
  451. missingTargets);
  452. if (!checkInterfaceDirs(prepro, target, propName))
  453. {
  454. return;
  455. }
  456. properties[propName] = prepro;
  457. }
  458. }
  459. //----------------------------------------------------------------------------
  460. void cmExportFileGenerator::PopulateInterfaceProperty(
  461. const std::string& propName,
  462. cmTarget *target,
  463. cmGeneratorExpression::PreprocessContext preprocessRule,
  464. ImportPropertyMap &properties,
  465. std::vector<std::string> &missingTargets)
  466. {
  467. this->PopulateInterfaceProperty(propName, propName, target, preprocessRule,
  468. properties, missingTargets);
  469. }
  470. //----------------------------------------------------------------------------
  471. void getPropertyContents(cmGeneratorTarget const* tgt,
  472. const std::string& prop,
  473. std::set<std::string> &ifaceProperties)
  474. {
  475. const char *p = tgt->GetProperty(prop);
  476. if (!p)
  477. {
  478. return;
  479. }
  480. std::vector<std::string> content;
  481. cmSystemTools::ExpandListArgument(p, content);
  482. ifaceProperties.insert(content.begin(), content.end());
  483. }
  484. //----------------------------------------------------------------------------
  485. void getCompatibleInterfaceProperties(cmGeneratorTarget *target,
  486. std::set<std::string> &ifaceProperties,
  487. const std::string& config)
  488. {
  489. cmComputeLinkInformation *info = target->GetLinkInformation(config);
  490. if (!info)
  491. {
  492. cmMakefile* mf = target->Target->GetMakefile();
  493. std::ostringstream e;
  494. e << "Exporting the target \"" << target->GetName() << "\" is not "
  495. "allowed since its linker language cannot be determined";
  496. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  497. return;
  498. }
  499. const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
  500. for(cmComputeLinkInformation::ItemVector::const_iterator li =
  501. deps.begin();
  502. li != deps.end(); ++li)
  503. {
  504. if (!li->Target)
  505. {
  506. continue;
  507. }
  508. getPropertyContents(li->Target,
  509. "COMPATIBLE_INTERFACE_BOOL",
  510. ifaceProperties);
  511. getPropertyContents(li->Target,
  512. "COMPATIBLE_INTERFACE_STRING",
  513. ifaceProperties);
  514. getPropertyContents(li->Target,
  515. "COMPATIBLE_INTERFACE_NUMBER_MIN",
  516. ifaceProperties);
  517. getPropertyContents(li->Target,
  518. "COMPATIBLE_INTERFACE_NUMBER_MAX",
  519. ifaceProperties);
  520. }
  521. }
  522. //----------------------------------------------------------------------------
  523. void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
  524. cmGeneratorTarget *gtarget,
  525. ImportPropertyMap &properties)
  526. {
  527. cmTarget *target = gtarget->Target;
  528. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL",
  529. target, properties);
  530. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING",
  531. target, properties);
  532. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MIN",
  533. target, properties);
  534. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MAX",
  535. target, properties);
  536. std::set<std::string> ifaceProperties;
  537. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties);
  538. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_STRING", ifaceProperties);
  539. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MIN",
  540. ifaceProperties);
  541. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
  542. ifaceProperties);
  543. if (target->GetType() != cmState::INTERFACE_LIBRARY)
  544. {
  545. getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
  546. std::vector<std::string> configNames;
  547. target->GetMakefile()->GetConfigurations(configNames);
  548. for (std::vector<std::string>::const_iterator ci = configNames.begin();
  549. ci != configNames.end(); ++ci)
  550. {
  551. getCompatibleInterfaceProperties(gtarget, ifaceProperties, *ci);
  552. }
  553. }
  554. for (std::set<std::string>::const_iterator it = ifaceProperties.begin();
  555. it != ifaceProperties.end(); ++it)
  556. {
  557. this->PopulateInterfaceProperty("INTERFACE_" + *it,
  558. target, properties);
  559. }
  560. }
  561. //----------------------------------------------------------------------------
  562. void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target,
  563. std::ostream& os,
  564. const ImportPropertyMap &properties)
  565. {
  566. if (!properties.empty())
  567. {
  568. std::string targetName = this->Namespace;
  569. targetName += target->GetExportName();
  570. os << "set_target_properties(" << targetName << " PROPERTIES\n";
  571. for(ImportPropertyMap::const_iterator pi = properties.begin();
  572. pi != properties.end(); ++pi)
  573. {
  574. os << " " << pi->first << " "
  575. << cmExportFileGeneratorEscape(pi->second) << "\n";
  576. }
  577. os << ")\n\n";
  578. }
  579. }
  580. //----------------------------------------------------------------------------
  581. bool
  582. cmExportFileGenerator::AddTargetNamespace(std::string &input,
  583. cmTarget* target,
  584. std::vector<std::string> &missingTargets)
  585. {
  586. cmMakefile *mf = target->GetMakefile();
  587. cmTarget *tgt = mf->FindTargetToUse(input);
  588. if (!tgt)
  589. {
  590. return false;
  591. }
  592. if(tgt->IsImported())
  593. {
  594. return true;
  595. }
  596. if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end())
  597. {
  598. input = this->Namespace + tgt->GetExportName();
  599. }
  600. else
  601. {
  602. std::string namespacedTarget;
  603. this->HandleMissingTarget(namespacedTarget, missingTargets,
  604. mf, target, tgt);
  605. if (!namespacedTarget.empty())
  606. {
  607. input = namespacedTarget;
  608. }
  609. }
  610. return true;
  611. }
  612. //----------------------------------------------------------------------------
  613. void
  614. cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
  615. std::string &input,
  616. cmTarget* target,
  617. std::vector<std::string> &missingTargets,
  618. FreeTargetsReplace replace)
  619. {
  620. if (replace == NoReplaceFreeTargets)
  621. {
  622. this->ResolveTargetsInGeneratorExpression(input, target, missingTargets);
  623. return;
  624. }
  625. std::vector<std::string> parts;
  626. cmGeneratorExpression::Split(input, parts);
  627. std::string sep;
  628. input = "";
  629. for(std::vector<std::string>::iterator li = parts.begin();
  630. li != parts.end(); ++li)
  631. {
  632. if (cmGeneratorExpression::Find(*li) == std::string::npos)
  633. {
  634. this->AddTargetNamespace(*li, target, missingTargets);
  635. }
  636. else
  637. {
  638. this->ResolveTargetsInGeneratorExpression(
  639. *li,
  640. target,
  641. missingTargets);
  642. }
  643. input += sep + *li;
  644. sep = ";";
  645. }
  646. }
  647. //----------------------------------------------------------------------------
  648. void
  649. cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
  650. std::string &input,
  651. cmTarget* target,
  652. std::vector<std::string> &missingTargets)
  653. {
  654. std::string::size_type pos = 0;
  655. std::string::size_type lastPos = pos;
  656. cmMakefile *mf = target->GetMakefile();
  657. while((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos)
  658. {
  659. std::string::size_type nameStartPos = pos +
  660. sizeof("$<TARGET_PROPERTY:") - 1;
  661. std::string::size_type closePos = input.find(">", nameStartPos);
  662. std::string::size_type commaPos = input.find(",", nameStartPos);
  663. std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
  664. if (commaPos == input.npos // Implied 'this' target
  665. || closePos == input.npos // Imcomplete expression.
  666. || closePos < commaPos // Implied 'this' target
  667. || nextOpenPos < commaPos) // Non-literal
  668. {
  669. lastPos = nameStartPos;
  670. continue;
  671. }
  672. std::string targetName = input.substr(nameStartPos,
  673. commaPos - nameStartPos);
  674. if (this->AddTargetNamespace(targetName, target, missingTargets))
  675. {
  676. input.replace(nameStartPos, commaPos - nameStartPos, targetName);
  677. }
  678. lastPos = nameStartPos + targetName.size() + 1;
  679. }
  680. std::string errorString;
  681. pos = 0;
  682. lastPos = pos;
  683. while((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos)
  684. {
  685. std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
  686. std::string::size_type endPos = input.find(">", nameStartPos);
  687. if (endPos == input.npos)
  688. {
  689. errorString = "$<TARGET_NAME:...> expression incomplete";
  690. break;
  691. }
  692. std::string targetName = input.substr(nameStartPos,
  693. endPos - nameStartPos);
  694. if(targetName.find("$<") != input.npos)
  695. {
  696. errorString = "$<TARGET_NAME:...> requires its parameter to be a "
  697. "literal.";
  698. break;
  699. }
  700. if (!this->AddTargetNamespace(targetName, target, missingTargets))
  701. {
  702. errorString = "$<TARGET_NAME:...> requires its parameter to be a "
  703. "reachable target.";
  704. break;
  705. }
  706. input.replace(pos, endPos - pos + 1, targetName);
  707. lastPos = endPos;
  708. }
  709. this->ReplaceInstallPrefix(input);
  710. if (!errorString.empty())
  711. {
  712. mf->IssueMessage(cmake::FATAL_ERROR, errorString);
  713. }
  714. }
  715. //----------------------------------------------------------------------------
  716. void
  717. cmExportFileGenerator::ReplaceInstallPrefix(std::string &)
  718. {
  719. // Do nothing
  720. }
  721. //----------------------------------------------------------------------------
  722. void
  723. cmExportFileGenerator
  724. ::SetImportLinkInterface(const std::string& config, std::string const& suffix,
  725. cmGeneratorExpression::PreprocessContext preprocessRule,
  726. cmGeneratorTarget* target, ImportPropertyMap& properties,
  727. std::vector<std::string>& missingTargets)
  728. {
  729. // Add the transitive link dependencies for this configuration.
  730. cmLinkInterface const* iface = target->GetLinkInterface(config,
  731. target);
  732. if (!iface)
  733. {
  734. return;
  735. }
  736. if (iface->ImplementationIsInterface)
  737. {
  738. // Policy CMP0022 must not be NEW.
  739. this->SetImportLinkProperty(suffix, target,
  740. "IMPORTED_LINK_INTERFACE_LIBRARIES",
  741. iface->Libraries, properties, missingTargets);
  742. return;
  743. }
  744. const char *propContent;
  745. if (const char *prop_suffixed = target->GetProperty(
  746. "LINK_INTERFACE_LIBRARIES" + suffix))
  747. {
  748. propContent = prop_suffixed;
  749. }
  750. else if (const char *prop = target->GetProperty(
  751. "LINK_INTERFACE_LIBRARIES"))
  752. {
  753. propContent = prop;
  754. }
  755. else
  756. {
  757. return;
  758. }
  759. const bool newCMP0022Behavior =
  760. target->Target
  761. ->GetPolicyStatusCMP0022() != cmPolicies::WARN
  762. && target->Target
  763. ->GetPolicyStatusCMP0022() != cmPolicies::OLD;
  764. if(newCMP0022Behavior && !this->ExportOld)
  765. {
  766. cmMakefile *mf = target->Target->GetMakefile();
  767. std::ostringstream e;
  768. e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
  769. "but also has old-style LINK_INTERFACE_LIBRARIES properties "
  770. "populated, but it was exported without the "
  771. "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
  772. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  773. return;
  774. }
  775. if (!*propContent)
  776. {
  777. properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = "";
  778. return;
  779. }
  780. std::string prepro = cmGeneratorExpression::Preprocess(propContent,
  781. preprocessRule);
  782. if (!prepro.empty())
  783. {
  784. this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
  785. missingTargets,
  786. ReplaceFreeTargets);
  787. properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
  788. }
  789. }
  790. //----------------------------------------------------------------------------
  791. void
  792. cmExportFileGenerator
  793. ::SetImportDetailProperties(const std::string& config,
  794. std::string const& suffix,
  795. cmGeneratorTarget* target,
  796. ImportPropertyMap& properties,
  797. std::vector<std::string>& missingTargets
  798. )
  799. {
  800. // Get the makefile in which to lookup target information.
  801. cmMakefile* mf = target->Makefile;
  802. // Add the soname for unix shared libraries.
  803. if(target->GetType() == cmState::SHARED_LIBRARY ||
  804. target->GetType() == cmState::MODULE_LIBRARY)
  805. {
  806. // Check whether this is a DLL platform.
  807. bool dll_platform =
  808. (mf->IsOn("WIN32") || mf->IsOn("CYGWIN") || mf->IsOn("MINGW"));
  809. if(!dll_platform)
  810. {
  811. std::string prop;
  812. std::string value;
  813. if(target->HasSOName(config))
  814. {
  815. if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
  816. {
  817. value = this->InstallNameDir(target, config);
  818. }
  819. prop = "IMPORTED_SONAME";
  820. value += target->GetSOName(config);
  821. }
  822. else
  823. {
  824. prop = "IMPORTED_NO_SONAME";
  825. value = "TRUE";
  826. }
  827. prop += suffix;
  828. properties[prop] = value;
  829. }
  830. }
  831. // Add the transitive link dependencies for this configuration.
  832. if(cmLinkInterface const* iface =
  833. target->GetLinkInterface(config, target))
  834. {
  835. this->SetImportLinkProperty(suffix, target,
  836. "IMPORTED_LINK_INTERFACE_LANGUAGES",
  837. iface->Languages, properties, missingTargets);
  838. std::vector<std::string> dummy;
  839. this->SetImportLinkProperty(suffix, target,
  840. "IMPORTED_LINK_DEPENDENT_LIBRARIES",
  841. iface->SharedDeps, properties, dummy);
  842. if(iface->Multiplicity > 0)
  843. {
  844. std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
  845. prop += suffix;
  846. std::ostringstream m;
  847. m << iface->Multiplicity;
  848. properties[prop] = m.str();
  849. }
  850. }
  851. }
  852. //----------------------------------------------------------------------------
  853. template <typename T>
  854. void
  855. cmExportFileGenerator
  856. ::SetImportLinkProperty(std::string const& suffix,
  857. cmGeneratorTarget* target,
  858. const std::string& propName,
  859. std::vector<T> const& entries,
  860. ImportPropertyMap& properties,
  861. std::vector<std::string>& missingTargets
  862. )
  863. {
  864. // Skip the property if there are no entries.
  865. if(entries.empty())
  866. {
  867. return;
  868. }
  869. // Construct the property value.
  870. std::string link_entries;
  871. const char* sep = "";
  872. for(typename std::vector<T>::const_iterator li = entries.begin();
  873. li != entries.end(); ++li)
  874. {
  875. // Separate this from the previous entry.
  876. link_entries += sep;
  877. sep = ";";
  878. std::string temp = *li;
  879. this->AddTargetNamespace(temp, target->Target, missingTargets);
  880. link_entries += temp;
  881. }
  882. // Store the property.
  883. std::string prop = propName;
  884. prop += suffix;
  885. properties[prop] = link_entries;
  886. }
  887. //----------------------------------------------------------------------------
  888. void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,
  889. const std::string& config)
  890. {
  891. os << "#----------------------------------------------------------------\n"
  892. << "# Generated CMake target import file";
  893. if(!config.empty())
  894. {
  895. os << " for configuration \"" << config << "\".\n";
  896. }
  897. else
  898. {
  899. os << ".\n";
  900. }
  901. os << "#----------------------------------------------------------------\n"
  902. << "\n";
  903. this->GenerateImportVersionCode(os);
  904. }
  905. //----------------------------------------------------------------------------
  906. void cmExportFileGenerator::GenerateImportFooterCode(std::ostream& os)
  907. {
  908. os << "# Commands beyond this point should not need to know the version.\n"
  909. << "set(CMAKE_IMPORT_FILE_VERSION)\n";
  910. }
  911. //----------------------------------------------------------------------------
  912. void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
  913. {
  914. // Store an import file format version. This will let us change the
  915. // format later while still allowing old import files to work.
  916. os << "# Commands may need to know the format version.\n"
  917. << "set(CMAKE_IMPORT_FILE_VERSION 1)\n"
  918. << "\n";
  919. }
  920. //----------------------------------------------------------------------------
  921. void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
  922. const std::string &expectedTargets)
  923. {
  924. os << "# Protect against multiple inclusion, which would fail when already "
  925. "imported targets are added once more.\n"
  926. "set(_targetsDefined)\n"
  927. "set(_targetsNotDefined)\n"
  928. "set(_expectedTargets)\n"
  929. "foreach(_expectedTarget " << expectedTargets << ")\n"
  930. " list(APPEND _expectedTargets ${_expectedTarget})\n"
  931. " if(NOT TARGET ${_expectedTarget})\n"
  932. " list(APPEND _targetsNotDefined ${_expectedTarget})\n"
  933. " endif()\n"
  934. " if(TARGET ${_expectedTarget})\n"
  935. " list(APPEND _targetsDefined ${_expectedTarget})\n"
  936. " endif()\n"
  937. "endforeach()\n"
  938. "if(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n"
  939. " set(CMAKE_IMPORT_FILE_VERSION)\n"
  940. " cmake_policy(POP)\n"
  941. " return()\n"
  942. "endif()\n"
  943. "if(NOT \"${_targetsDefined}\" STREQUAL \"\")\n"
  944. " message(FATAL_ERROR \"Some (but not all) targets in this export "
  945. "set were already defined.\\nTargets Defined: ${_targetsDefined}\\n"
  946. "Targets not yet defined: ${_targetsNotDefined}\\n\")\n"
  947. "endif()\n"
  948. "unset(_targetsDefined)\n"
  949. "unset(_targetsNotDefined)\n"
  950. "unset(_expectedTargets)\n"
  951. "\n\n";
  952. }
  953. //----------------------------------------------------------------------------
  954. void
  955. cmExportFileGenerator
  956. ::GenerateImportTargetCode(std::ostream& os, cmTarget const* target)
  957. {
  958. // Construct the imported target name.
  959. std::string targetName = this->Namespace;
  960. targetName += target->GetExportName();
  961. // Create the imported target.
  962. os << "# Create imported target " << targetName << "\n";
  963. switch(target->GetType())
  964. {
  965. case cmState::EXECUTABLE:
  966. os << "add_executable(" << targetName << " IMPORTED)\n";
  967. break;
  968. case cmState::STATIC_LIBRARY:
  969. os << "add_library(" << targetName << " STATIC IMPORTED)\n";
  970. break;
  971. case cmState::SHARED_LIBRARY:
  972. os << "add_library(" << targetName << " SHARED IMPORTED)\n";
  973. break;
  974. case cmState::MODULE_LIBRARY:
  975. os << "add_library(" << targetName << " MODULE IMPORTED)\n";
  976. break;
  977. case cmState::UNKNOWN_LIBRARY:
  978. os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
  979. break;
  980. case cmState::INTERFACE_LIBRARY:
  981. os << "add_library(" << targetName << " INTERFACE IMPORTED)\n";
  982. break;
  983. default: // should never happen
  984. break;
  985. }
  986. // Mark the imported executable if it has exports.
  987. if(target->IsExecutableWithExports())
  988. {
  989. os << "set_property(TARGET " << targetName
  990. << " PROPERTY ENABLE_EXPORTS 1)\n";
  991. }
  992. // Mark the imported library if it is a framework.
  993. if(target->IsFrameworkOnApple())
  994. {
  995. os << "set_property(TARGET " << targetName
  996. << " PROPERTY FRAMEWORK 1)\n";
  997. }
  998. // Mark the imported executable if it is an application bundle.
  999. if(target->IsAppBundleOnApple())
  1000. {
  1001. os << "set_property(TARGET " << targetName
  1002. << " PROPERTY MACOSX_BUNDLE 1)\n";
  1003. }
  1004. if (target->IsCFBundleOnApple())
  1005. {
  1006. os << "set_property(TARGET " << targetName
  1007. << " PROPERTY BUNDLE 1)\n";
  1008. }
  1009. os << "\n";
  1010. }
  1011. //----------------------------------------------------------------------------
  1012. void
  1013. cmExportFileGenerator
  1014. ::GenerateImportPropertyCode(std::ostream& os, const std::string& config,
  1015. cmTarget const* target,
  1016. ImportPropertyMap const& properties)
  1017. {
  1018. // Construct the imported target name.
  1019. std::string targetName = this->Namespace;
  1020. targetName += target->GetExportName();
  1021. // Set the import properties.
  1022. os << "# Import target \"" << targetName << "\" for configuration \""
  1023. << config << "\"\n";
  1024. os << "set_property(TARGET " << targetName
  1025. << " APPEND PROPERTY IMPORTED_CONFIGURATIONS ";
  1026. if(!config.empty())
  1027. {
  1028. os << cmSystemTools::UpperCase(config);
  1029. }
  1030. else
  1031. {
  1032. os << "NOCONFIG";
  1033. }
  1034. os << ")\n";
  1035. os << "set_target_properties(" << targetName << " PROPERTIES\n";
  1036. for(ImportPropertyMap::const_iterator pi = properties.begin();
  1037. pi != properties.end(); ++pi)
  1038. {
  1039. os << " " << pi->first << " "
  1040. << cmExportFileGeneratorEscape(pi->second) << "\n";
  1041. }
  1042. os << " )\n"
  1043. << "\n";
  1044. }
  1045. //----------------------------------------------------------------------------
  1046. void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
  1047. const std::vector<std::string>& missingTargets)
  1048. {
  1049. if (missingTargets.empty())
  1050. {
  1051. os << "# This file does not depend on other imported targets which have\n"
  1052. "# been exported from the same project but in a separate "
  1053. "export set.\n\n";
  1054. return;
  1055. }
  1056. os << "# Make sure the targets which have been exported in some other \n"
  1057. "# export set exist.\n"
  1058. "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
  1059. "foreach(_target ";
  1060. std::set<std::string> emitted;
  1061. for(unsigned int i=0; i<missingTargets.size(); ++i)
  1062. {
  1063. if (emitted.insert(missingTargets[i]).second)
  1064. {
  1065. os << "\"" << missingTargets[i] << "\" ";
  1066. }
  1067. }
  1068. os << ")\n"
  1069. " if(NOT TARGET \"${_target}\" )\n"
  1070. " set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets \""
  1071. "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets} ${_target}\")"
  1072. "\n"
  1073. " endif()\n"
  1074. "endforeach()\n"
  1075. "\n"
  1076. "if(DEFINED ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
  1077. " if(CMAKE_FIND_PACKAGE_NAME)\n"
  1078. " set( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
  1079. " set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
  1080. "\"The following imported targets are "
  1081. "referenced, but are missing: "
  1082. "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
  1083. " else()\n"
  1084. " message(FATAL_ERROR \"The following imported targets are "
  1085. "referenced, but are missing: "
  1086. "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
  1087. " endif()\n"
  1088. "endif()\n"
  1089. "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
  1090. "\n";
  1091. }
  1092. //----------------------------------------------------------------------------
  1093. void
  1094. cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
  1095. {
  1096. // Add code which verifies at cmake time that the file which is being
  1097. // imported actually exists on disk. This should in theory always be theory
  1098. // case, but still when packages are split into normal and development
  1099. // packages this might get broken (e.g. the Config.cmake could be part of
  1100. // the non-development package, something similar happened to me without
  1101. // on SUSE with a mysql pkg-config file, which claimed everything is fine,
  1102. // but the development package was not installed.).
  1103. os << "# Loop over all imported files and verify that they actually exist\n"
  1104. "foreach(target ${_IMPORT_CHECK_TARGETS} )\n"
  1105. " foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n"
  1106. " if(NOT EXISTS \"${file}\" )\n"
  1107. " message(FATAL_ERROR \"The imported target \\\"${target}\\\""
  1108. " references the file\n"
  1109. " \\\"${file}\\\"\n"
  1110. "but this file does not exist. Possible reasons include:\n"
  1111. "* The file was deleted, renamed, or moved to another location.\n"
  1112. "* An install or uninstall procedure did not complete successfully.\n"
  1113. "* The installation package was faulty and contained\n"
  1114. " \\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n"
  1115. "but not all the files it references.\n"
  1116. "\")\n"
  1117. " endif()\n"
  1118. " endforeach()\n"
  1119. " unset(_IMPORT_CHECK_FILES_FOR_${target})\n"
  1120. "endforeach()\n"
  1121. "unset(_IMPORT_CHECK_TARGETS)\n"
  1122. "\n";
  1123. }
  1124. //----------------------------------------------------------------------------
  1125. void
  1126. cmExportFileGenerator
  1127. ::GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
  1128. ImportPropertyMap const& properties,
  1129. const std::set<std::string>& importedLocations)
  1130. {
  1131. // Construct the imported target name.
  1132. std::string targetName = this->Namespace;
  1133. targetName += target->GetExportName();
  1134. os << "list(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n"
  1135. "list(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " ";
  1136. for(std::set<std::string>::const_iterator li = importedLocations.begin();
  1137. li != importedLocations.end();
  1138. ++li)
  1139. {
  1140. ImportPropertyMap::const_iterator pi = properties.find(*li);
  1141. if (pi != properties.end())
  1142. {
  1143. os << cmExportFileGeneratorEscape(pi->second) << " ";
  1144. }
  1145. }
  1146. os << ")\n\n";
  1147. }