cmExportFileGenerator.cxx 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254
  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. cmGeneratorTarget *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. cmGeneratorTarget *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. cmGeneratorTarget *target,
  187. cmGeneratorExpression::PreprocessContext preprocessRule,
  188. ImportPropertyMap &properties,
  189. std::vector<std::string> &missingTargets)
  190. {
  191. if(!target->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. cmGeneratorTarget* gt = tei->Target;
  370. assert(preprocessRule == cmGeneratorExpression::InstallInterface);
  371. const char *propName = "INTERFACE_SOURCES";
  372. const char *input = gt->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, gt,
  388. missingTargets);
  389. if (!checkInterfaceDirs(prepro, gt, propName))
  390. {
  391. return;
  392. }
  393. properties[propName] = prepro;
  394. }
  395. }
  396. //----------------------------------------------------------------------------
  397. void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
  398. cmTargetExport *tei,
  399. cmGeneratorExpression::PreprocessContext preprocessRule,
  400. ImportPropertyMap &properties,
  401. std::vector<std::string> &missingTargets)
  402. {
  403. cmGeneratorTarget *target = tei->Target;
  404. assert(preprocessRule == cmGeneratorExpression::InstallInterface);
  405. const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
  406. const char *input = target->GetProperty(propName);
  407. cmGeneratorExpression ge;
  408. std::string dirs = cmGeneratorExpression::Preprocess(
  409. tei->InterfaceIncludeDirectories,
  410. preprocessRule,
  411. true);
  412. this->ReplaceInstallPrefix(dirs);
  413. cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
  414. std::string exportDirs = cge->Evaluate(target->GetLocalGenerator(), "",
  415. false, target);
  416. if (cge->GetHadContextSensitiveCondition())
  417. {
  418. cmMakefile* mf = target->Target->GetMakefile();
  419. std::ostringstream e;
  420. e << "Target \"" << target->GetName() << "\" is installed with "
  421. "INCLUDES DESTINATION set to a context sensitive path. Paths which "
  422. "depend on the configuration, policy values or the link interface are "
  423. "not supported. Consider using target_include_directories instead.";
  424. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  425. return;
  426. }
  427. if (!input && exportDirs.empty())
  428. {
  429. return;
  430. }
  431. if ((input && !*input) && exportDirs.empty())
  432. {
  433. // Set to empty
  434. properties[propName] = "";
  435. return;
  436. }
  437. prefixItems(exportDirs);
  438. std::string includes = (input?input:"");
  439. const char* sep = input ? ";" : "";
  440. includes += sep + exportDirs;
  441. std::string prepro = cmGeneratorExpression::Preprocess(includes,
  442. preprocessRule,
  443. true);
  444. if (!prepro.empty())
  445. {
  446. this->ResolveTargetsInGeneratorExpressions(prepro, target,
  447. missingTargets);
  448. if (!checkInterfaceDirs(prepro, target, propName))
  449. {
  450. return;
  451. }
  452. properties[propName] = prepro;
  453. }
  454. }
  455. //----------------------------------------------------------------------------
  456. void cmExportFileGenerator::PopulateInterfaceProperty(
  457. const std::string& propName,
  458. cmGeneratorTarget* target,
  459. cmGeneratorExpression::PreprocessContext preprocessRule,
  460. ImportPropertyMap &properties,
  461. std::vector<std::string> &missingTargets)
  462. {
  463. this->PopulateInterfaceProperty(propName, propName, target, preprocessRule,
  464. properties, missingTargets);
  465. }
  466. //----------------------------------------------------------------------------
  467. void getPropertyContents(cmGeneratorTarget const* tgt,
  468. const std::string& prop,
  469. std::set<std::string> &ifaceProperties)
  470. {
  471. const char *p = tgt->GetProperty(prop);
  472. if (!p)
  473. {
  474. return;
  475. }
  476. std::vector<std::string> content;
  477. cmSystemTools::ExpandListArgument(p, content);
  478. ifaceProperties.insert(content.begin(), content.end());
  479. }
  480. //----------------------------------------------------------------------------
  481. void getCompatibleInterfaceProperties(cmGeneratorTarget *target,
  482. std::set<std::string> &ifaceProperties,
  483. const std::string& config)
  484. {
  485. cmComputeLinkInformation *info = target->GetLinkInformation(config);
  486. if (!info)
  487. {
  488. cmMakefile* mf = target->Target->GetMakefile();
  489. std::ostringstream e;
  490. e << "Exporting the target \"" << target->GetName() << "\" is not "
  491. "allowed since its linker language cannot be determined";
  492. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  493. return;
  494. }
  495. const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
  496. for(cmComputeLinkInformation::ItemVector::const_iterator li =
  497. deps.begin();
  498. li != deps.end(); ++li)
  499. {
  500. if (!li->Target)
  501. {
  502. continue;
  503. }
  504. getPropertyContents(li->Target,
  505. "COMPATIBLE_INTERFACE_BOOL",
  506. ifaceProperties);
  507. getPropertyContents(li->Target,
  508. "COMPATIBLE_INTERFACE_STRING",
  509. ifaceProperties);
  510. getPropertyContents(li->Target,
  511. "COMPATIBLE_INTERFACE_NUMBER_MIN",
  512. ifaceProperties);
  513. getPropertyContents(li->Target,
  514. "COMPATIBLE_INTERFACE_NUMBER_MAX",
  515. ifaceProperties);
  516. }
  517. }
  518. //----------------------------------------------------------------------------
  519. void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
  520. cmGeneratorTarget *gtarget,
  521. ImportPropertyMap &properties)
  522. {
  523. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_BOOL",
  524. gtarget, properties);
  525. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_STRING",
  526. gtarget, properties);
  527. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MIN",
  528. gtarget, properties);
  529. this->PopulateInterfaceProperty("COMPATIBLE_INTERFACE_NUMBER_MAX",
  530. gtarget, properties);
  531. std::set<std::string> ifaceProperties;
  532. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_BOOL", ifaceProperties);
  533. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_STRING", ifaceProperties);
  534. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MIN",
  535. ifaceProperties);
  536. getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
  537. ifaceProperties);
  538. if (gtarget->GetType() != cmState::INTERFACE_LIBRARY)
  539. {
  540. getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
  541. std::vector<std::string> configNames;
  542. gtarget->Target->GetMakefile()->GetConfigurations(configNames);
  543. for (std::vector<std::string>::const_iterator ci = configNames.begin();
  544. ci != configNames.end(); ++ci)
  545. {
  546. getCompatibleInterfaceProperties(gtarget, ifaceProperties, *ci);
  547. }
  548. }
  549. for (std::set<std::string>::const_iterator it = ifaceProperties.begin();
  550. it != ifaceProperties.end(); ++it)
  551. {
  552. this->PopulateInterfaceProperty("INTERFACE_" + *it,
  553. gtarget, properties);
  554. }
  555. }
  556. //----------------------------------------------------------------------------
  557. void cmExportFileGenerator::GenerateInterfaceProperties(
  558. const cmGeneratorTarget* target,
  559. std::ostream& os,
  560. const ImportPropertyMap &properties)
  561. {
  562. if (!properties.empty())
  563. {
  564. std::string targetName = this->Namespace;
  565. targetName += target->Target->GetExportName();
  566. os << "set_target_properties(" << targetName << " PROPERTIES\n";
  567. for(ImportPropertyMap::const_iterator pi = properties.begin();
  568. pi != properties.end(); ++pi)
  569. {
  570. os << " " << pi->first << " "
  571. << cmExportFileGeneratorEscape(pi->second) << "\n";
  572. }
  573. os << ")\n\n";
  574. }
  575. }
  576. //----------------------------------------------------------------------------
  577. bool
  578. cmExportFileGenerator::AddTargetNamespace(std::string &input,
  579. cmGeneratorTarget* target,
  580. std::vector<std::string> &missingTargets)
  581. {
  582. cmLocalGenerator *lg = target->GetLocalGenerator();
  583. cmGeneratorTarget *tgt = lg->FindGeneratorTargetToUse(input);
  584. if (!tgt)
  585. {
  586. return false;
  587. }
  588. if(tgt->IsImported())
  589. {
  590. return true;
  591. }
  592. if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end())
  593. {
  594. input = this->Namespace + tgt->Target->GetExportName();
  595. }
  596. else
  597. {
  598. std::string namespacedTarget;
  599. this->HandleMissingTarget(namespacedTarget, missingTargets,
  600. target->Target, tgt->Target);
  601. if (!namespacedTarget.empty())
  602. {
  603. input = namespacedTarget;
  604. }
  605. }
  606. return true;
  607. }
  608. //----------------------------------------------------------------------------
  609. void
  610. cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
  611. std::string &input,
  612. cmGeneratorTarget* target,
  613. std::vector<std::string> &missingTargets,
  614. FreeTargetsReplace replace)
  615. {
  616. if (replace == NoReplaceFreeTargets)
  617. {
  618. this->ResolveTargetsInGeneratorExpression(input, target, missingTargets);
  619. return;
  620. }
  621. std::vector<std::string> parts;
  622. cmGeneratorExpression::Split(input, parts);
  623. std::string sep;
  624. input = "";
  625. for(std::vector<std::string>::iterator li = parts.begin();
  626. li != parts.end(); ++li)
  627. {
  628. if (cmGeneratorExpression::Find(*li) == std::string::npos)
  629. {
  630. this->AddTargetNamespace(*li, target, missingTargets);
  631. }
  632. else
  633. {
  634. this->ResolveTargetsInGeneratorExpression(
  635. *li,
  636. target,
  637. missingTargets);
  638. }
  639. input += sep + *li;
  640. sep = ";";
  641. }
  642. }
  643. //----------------------------------------------------------------------------
  644. void
  645. cmExportFileGenerator::ResolveTargetsInGeneratorExpression(
  646. std::string &input,
  647. cmGeneratorTarget* target,
  648. std::vector<std::string> &missingTargets)
  649. {
  650. std::string::size_type pos = 0;
  651. std::string::size_type lastPos = pos;
  652. while((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos)
  653. {
  654. std::string::size_type nameStartPos = pos +
  655. sizeof("$<TARGET_PROPERTY:") - 1;
  656. std::string::size_type closePos = input.find(">", nameStartPos);
  657. std::string::size_type commaPos = input.find(",", nameStartPos);
  658. std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
  659. if (commaPos == input.npos // Implied 'this' target
  660. || closePos == input.npos // Imcomplete expression.
  661. || closePos < commaPos // Implied 'this' target
  662. || nextOpenPos < commaPos) // Non-literal
  663. {
  664. lastPos = nameStartPos;
  665. continue;
  666. }
  667. std::string targetName = input.substr(nameStartPos,
  668. commaPos - nameStartPos);
  669. if (this->AddTargetNamespace(targetName, target, missingTargets))
  670. {
  671. input.replace(nameStartPos, commaPos - nameStartPos, targetName);
  672. }
  673. lastPos = nameStartPos + targetName.size() + 1;
  674. }
  675. std::string errorString;
  676. pos = 0;
  677. lastPos = pos;
  678. while((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos)
  679. {
  680. std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
  681. std::string::size_type endPos = input.find(">", nameStartPos);
  682. if (endPos == input.npos)
  683. {
  684. errorString = "$<TARGET_NAME:...> expression incomplete";
  685. break;
  686. }
  687. std::string targetName = input.substr(nameStartPos,
  688. endPos - nameStartPos);
  689. if(targetName.find("$<") != input.npos)
  690. {
  691. errorString = "$<TARGET_NAME:...> requires its parameter to be a "
  692. "literal.";
  693. break;
  694. }
  695. if (!this->AddTargetNamespace(targetName, target, missingTargets))
  696. {
  697. errorString = "$<TARGET_NAME:...> requires its parameter to be a "
  698. "reachable target.";
  699. break;
  700. }
  701. input.replace(pos, endPos - pos + 1, targetName);
  702. lastPos = endPos;
  703. }
  704. this->ReplaceInstallPrefix(input);
  705. if (!errorString.empty())
  706. {
  707. target->GetLocalGenerator()->IssueMessage(cmake::FATAL_ERROR, errorString);
  708. }
  709. }
  710. //----------------------------------------------------------------------------
  711. void
  712. cmExportFileGenerator::ReplaceInstallPrefix(std::string &)
  713. {
  714. // Do nothing
  715. }
  716. //----------------------------------------------------------------------------
  717. void
  718. cmExportFileGenerator
  719. ::SetImportLinkInterface(const std::string& config, std::string const& suffix,
  720. cmGeneratorExpression::PreprocessContext preprocessRule,
  721. cmGeneratorTarget* target, ImportPropertyMap& properties,
  722. std::vector<std::string>& missingTargets)
  723. {
  724. // Add the transitive link dependencies for this configuration.
  725. cmLinkInterface const* iface = target->GetLinkInterface(config,
  726. target);
  727. if (!iface)
  728. {
  729. return;
  730. }
  731. if (iface->ImplementationIsInterface)
  732. {
  733. // Policy CMP0022 must not be NEW.
  734. this->SetImportLinkProperty(suffix, target,
  735. "IMPORTED_LINK_INTERFACE_LIBRARIES",
  736. iface->Libraries, properties, missingTargets);
  737. return;
  738. }
  739. const char *propContent;
  740. if (const char *prop_suffixed = target->GetProperty(
  741. "LINK_INTERFACE_LIBRARIES" + suffix))
  742. {
  743. propContent = prop_suffixed;
  744. }
  745. else if (const char *prop = target->GetProperty(
  746. "LINK_INTERFACE_LIBRARIES"))
  747. {
  748. propContent = prop;
  749. }
  750. else
  751. {
  752. return;
  753. }
  754. const bool newCMP0022Behavior =
  755. target->Target
  756. ->GetPolicyStatusCMP0022() != cmPolicies::WARN
  757. && target->Target
  758. ->GetPolicyStatusCMP0022() != cmPolicies::OLD;
  759. if(newCMP0022Behavior && !this->ExportOld)
  760. {
  761. cmMakefile *mf = target->Target->GetMakefile();
  762. std::ostringstream e;
  763. e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
  764. "but also has old-style LINK_INTERFACE_LIBRARIES properties "
  765. "populated, but it was exported without the "
  766. "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
  767. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  768. return;
  769. }
  770. if (!*propContent)
  771. {
  772. properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = "";
  773. return;
  774. }
  775. std::string prepro = cmGeneratorExpression::Preprocess(propContent,
  776. preprocessRule);
  777. if (!prepro.empty())
  778. {
  779. this->ResolveTargetsInGeneratorExpressions(prepro, target,
  780. missingTargets,
  781. ReplaceFreeTargets);
  782. properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = prepro;
  783. }
  784. }
  785. //----------------------------------------------------------------------------
  786. void
  787. cmExportFileGenerator
  788. ::SetImportDetailProperties(const std::string& config,
  789. std::string const& suffix,
  790. cmGeneratorTarget* target,
  791. ImportPropertyMap& properties,
  792. std::vector<std::string>& missingTargets
  793. )
  794. {
  795. // Get the makefile in which to lookup target information.
  796. cmMakefile* mf = target->Makefile;
  797. // Add the soname for unix shared libraries.
  798. if(target->GetType() == cmState::SHARED_LIBRARY ||
  799. target->GetType() == cmState::MODULE_LIBRARY)
  800. {
  801. // Check whether this is a DLL platform.
  802. bool dll_platform =
  803. (mf->IsOn("WIN32") || mf->IsOn("CYGWIN") || mf->IsOn("MINGW"));
  804. if(!dll_platform)
  805. {
  806. std::string prop;
  807. std::string value;
  808. if(target->HasSOName(config))
  809. {
  810. if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME"))
  811. {
  812. value = this->InstallNameDir(target, config);
  813. }
  814. prop = "IMPORTED_SONAME";
  815. value += target->GetSOName(config);
  816. }
  817. else
  818. {
  819. prop = "IMPORTED_NO_SONAME";
  820. value = "TRUE";
  821. }
  822. prop += suffix;
  823. properties[prop] = value;
  824. }
  825. }
  826. // Add the transitive link dependencies for this configuration.
  827. if(cmLinkInterface const* iface =
  828. target->GetLinkInterface(config, target))
  829. {
  830. this->SetImportLinkProperty(suffix, target,
  831. "IMPORTED_LINK_INTERFACE_LANGUAGES",
  832. iface->Languages, properties, missingTargets);
  833. std::vector<std::string> dummy;
  834. this->SetImportLinkProperty(suffix, target,
  835. "IMPORTED_LINK_DEPENDENT_LIBRARIES",
  836. iface->SharedDeps, properties, dummy);
  837. if(iface->Multiplicity > 0)
  838. {
  839. std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
  840. prop += suffix;
  841. std::ostringstream m;
  842. m << iface->Multiplicity;
  843. properties[prop] = m.str();
  844. }
  845. }
  846. }
  847. //----------------------------------------------------------------------------
  848. template <typename T>
  849. void
  850. cmExportFileGenerator
  851. ::SetImportLinkProperty(std::string const& suffix,
  852. cmGeneratorTarget* target,
  853. const std::string& propName,
  854. std::vector<T> const& entries,
  855. ImportPropertyMap& properties,
  856. std::vector<std::string>& missingTargets
  857. )
  858. {
  859. // Skip the property if there are no entries.
  860. if(entries.empty())
  861. {
  862. return;
  863. }
  864. // Construct the property value.
  865. std::string link_entries;
  866. const char* sep = "";
  867. for(typename std::vector<T>::const_iterator li = entries.begin();
  868. li != entries.end(); ++li)
  869. {
  870. // Separate this from the previous entry.
  871. link_entries += sep;
  872. sep = ";";
  873. std::string temp = *li;
  874. this->AddTargetNamespace(temp, target, missingTargets);
  875. link_entries += temp;
  876. }
  877. // Store the property.
  878. std::string prop = propName;
  879. prop += suffix;
  880. properties[prop] = link_entries;
  881. }
  882. //----------------------------------------------------------------------------
  883. void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,
  884. const std::string& config)
  885. {
  886. os << "#----------------------------------------------------------------\n"
  887. << "# Generated CMake target import file";
  888. if(!config.empty())
  889. {
  890. os << " for configuration \"" << config << "\".\n";
  891. }
  892. else
  893. {
  894. os << ".\n";
  895. }
  896. os << "#----------------------------------------------------------------\n"
  897. << "\n";
  898. this->GenerateImportVersionCode(os);
  899. }
  900. //----------------------------------------------------------------------------
  901. void cmExportFileGenerator::GenerateImportFooterCode(std::ostream& os)
  902. {
  903. os << "# Commands beyond this point should not need to know the version.\n"
  904. << "set(CMAKE_IMPORT_FILE_VERSION)\n";
  905. }
  906. //----------------------------------------------------------------------------
  907. void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
  908. {
  909. // Store an import file format version. This will let us change the
  910. // format later while still allowing old import files to work.
  911. os << "# Commands may need to know the format version.\n"
  912. << "set(CMAKE_IMPORT_FILE_VERSION 1)\n"
  913. << "\n";
  914. }
  915. //----------------------------------------------------------------------------
  916. void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
  917. const std::string &expectedTargets)
  918. {
  919. os << "# Protect against multiple inclusion, which would fail when already "
  920. "imported targets are added once more.\n"
  921. "set(_targetsDefined)\n"
  922. "set(_targetsNotDefined)\n"
  923. "set(_expectedTargets)\n"
  924. "foreach(_expectedTarget " << expectedTargets << ")\n"
  925. " list(APPEND _expectedTargets ${_expectedTarget})\n"
  926. " if(NOT TARGET ${_expectedTarget})\n"
  927. " list(APPEND _targetsNotDefined ${_expectedTarget})\n"
  928. " endif()\n"
  929. " if(TARGET ${_expectedTarget})\n"
  930. " list(APPEND _targetsDefined ${_expectedTarget})\n"
  931. " endif()\n"
  932. "endforeach()\n"
  933. "if(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n"
  934. " set(CMAKE_IMPORT_FILE_VERSION)\n"
  935. " cmake_policy(POP)\n"
  936. " return()\n"
  937. "endif()\n"
  938. "if(NOT \"${_targetsDefined}\" STREQUAL \"\")\n"
  939. " message(FATAL_ERROR \"Some (but not all) targets in this export "
  940. "set were already defined.\\nTargets Defined: ${_targetsDefined}\\n"
  941. "Targets not yet defined: ${_targetsNotDefined}\\n\")\n"
  942. "endif()\n"
  943. "unset(_targetsDefined)\n"
  944. "unset(_targetsNotDefined)\n"
  945. "unset(_expectedTargets)\n"
  946. "\n\n";
  947. }
  948. //----------------------------------------------------------------------------
  949. void
  950. cmExportFileGenerator
  951. ::GenerateImportTargetCode(std::ostream& os, const cmGeneratorTarget* target)
  952. {
  953. // Construct the imported target name.
  954. std::string targetName = this->Namespace;
  955. targetName += target->Target->GetExportName();
  956. // Create the imported target.
  957. os << "# Create imported target " << targetName << "\n";
  958. switch(target->GetType())
  959. {
  960. case cmState::EXECUTABLE:
  961. os << "add_executable(" << targetName << " IMPORTED)\n";
  962. break;
  963. case cmState::STATIC_LIBRARY:
  964. os << "add_library(" << targetName << " STATIC IMPORTED)\n";
  965. break;
  966. case cmState::SHARED_LIBRARY:
  967. os << "add_library(" << targetName << " SHARED IMPORTED)\n";
  968. break;
  969. case cmState::MODULE_LIBRARY:
  970. os << "add_library(" << targetName << " MODULE IMPORTED)\n";
  971. break;
  972. case cmState::UNKNOWN_LIBRARY:
  973. os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
  974. break;
  975. case cmState::INTERFACE_LIBRARY:
  976. os << "add_library(" << targetName << " INTERFACE IMPORTED)\n";
  977. break;
  978. default: // should never happen
  979. break;
  980. }
  981. // Mark the imported executable if it has exports.
  982. if(target->Target->IsExecutableWithExports())
  983. {
  984. os << "set_property(TARGET " << targetName
  985. << " PROPERTY ENABLE_EXPORTS 1)\n";
  986. }
  987. // Mark the imported library if it is a framework.
  988. if(target->Target->IsFrameworkOnApple())
  989. {
  990. os << "set_property(TARGET " << targetName
  991. << " PROPERTY FRAMEWORK 1)\n";
  992. }
  993. // Mark the imported executable if it is an application bundle.
  994. if(target->Target->IsAppBundleOnApple())
  995. {
  996. os << "set_property(TARGET " << targetName
  997. << " PROPERTY MACOSX_BUNDLE 1)\n";
  998. }
  999. if (target->Target->IsCFBundleOnApple())
  1000. {
  1001. os << "set_property(TARGET " << targetName
  1002. << " PROPERTY BUNDLE 1)\n";
  1003. }
  1004. os << "\n";
  1005. }
  1006. //----------------------------------------------------------------------------
  1007. void
  1008. cmExportFileGenerator
  1009. ::GenerateImportPropertyCode(std::ostream& os, const std::string& config,
  1010. cmTarget const* target,
  1011. ImportPropertyMap const& properties)
  1012. {
  1013. // Construct the imported target name.
  1014. std::string targetName = this->Namespace;
  1015. targetName += target->GetExportName();
  1016. // Set the import properties.
  1017. os << "# Import target \"" << targetName << "\" for configuration \""
  1018. << config << "\"\n";
  1019. os << "set_property(TARGET " << targetName
  1020. << " APPEND PROPERTY IMPORTED_CONFIGURATIONS ";
  1021. if(!config.empty())
  1022. {
  1023. os << cmSystemTools::UpperCase(config);
  1024. }
  1025. else
  1026. {
  1027. os << "NOCONFIG";
  1028. }
  1029. os << ")\n";
  1030. os << "set_target_properties(" << targetName << " PROPERTIES\n";
  1031. for(ImportPropertyMap::const_iterator pi = properties.begin();
  1032. pi != properties.end(); ++pi)
  1033. {
  1034. os << " " << pi->first << " "
  1035. << cmExportFileGeneratorEscape(pi->second) << "\n";
  1036. }
  1037. os << " )\n"
  1038. << "\n";
  1039. }
  1040. //----------------------------------------------------------------------------
  1041. void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
  1042. const std::vector<std::string>& missingTargets)
  1043. {
  1044. if (missingTargets.empty())
  1045. {
  1046. os << "# This file does not depend on other imported targets which have\n"
  1047. "# been exported from the same project but in a separate "
  1048. "export set.\n\n";
  1049. return;
  1050. }
  1051. os << "# Make sure the targets which have been exported in some other \n"
  1052. "# export set exist.\n"
  1053. "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
  1054. "foreach(_target ";
  1055. std::set<std::string> emitted;
  1056. for(unsigned int i=0; i<missingTargets.size(); ++i)
  1057. {
  1058. if (emitted.insert(missingTargets[i]).second)
  1059. {
  1060. os << "\"" << missingTargets[i] << "\" ";
  1061. }
  1062. }
  1063. os << ")\n"
  1064. " if(NOT TARGET \"${_target}\" )\n"
  1065. " set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets \""
  1066. "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets} ${_target}\")"
  1067. "\n"
  1068. " endif()\n"
  1069. "endforeach()\n"
  1070. "\n"
  1071. "if(DEFINED ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
  1072. " if(CMAKE_FIND_PACKAGE_NAME)\n"
  1073. " set( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
  1074. " set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
  1075. "\"The following imported targets are "
  1076. "referenced, but are missing: "
  1077. "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
  1078. " else()\n"
  1079. " message(FATAL_ERROR \"The following imported targets are "
  1080. "referenced, but are missing: "
  1081. "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}\")\n"
  1082. " endif()\n"
  1083. "endif()\n"
  1084. "unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)\n"
  1085. "\n";
  1086. }
  1087. //----------------------------------------------------------------------------
  1088. void
  1089. cmExportFileGenerator::GenerateImportedFileCheckLoop(std::ostream& os)
  1090. {
  1091. // Add code which verifies at cmake time that the file which is being
  1092. // imported actually exists on disk. This should in theory always be theory
  1093. // case, but still when packages are split into normal and development
  1094. // packages this might get broken (e.g. the Config.cmake could be part of
  1095. // the non-development package, something similar happened to me without
  1096. // on SUSE with a mysql pkg-config file, which claimed everything is fine,
  1097. // but the development package was not installed.).
  1098. os << "# Loop over all imported files and verify that they actually exist\n"
  1099. "foreach(target ${_IMPORT_CHECK_TARGETS} )\n"
  1100. " foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )\n"
  1101. " if(NOT EXISTS \"${file}\" )\n"
  1102. " message(FATAL_ERROR \"The imported target \\\"${target}\\\""
  1103. " references the file\n"
  1104. " \\\"${file}\\\"\n"
  1105. "but this file does not exist. Possible reasons include:\n"
  1106. "* The file was deleted, renamed, or moved to another location.\n"
  1107. "* An install or uninstall procedure did not complete successfully.\n"
  1108. "* The installation package was faulty and contained\n"
  1109. " \\\"${CMAKE_CURRENT_LIST_FILE}\\\"\n"
  1110. "but not all the files it references.\n"
  1111. "\")\n"
  1112. " endif()\n"
  1113. " endforeach()\n"
  1114. " unset(_IMPORT_CHECK_FILES_FOR_${target})\n"
  1115. "endforeach()\n"
  1116. "unset(_IMPORT_CHECK_TARGETS)\n"
  1117. "\n";
  1118. }
  1119. //----------------------------------------------------------------------------
  1120. void
  1121. cmExportFileGenerator
  1122. ::GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
  1123. ImportPropertyMap const& properties,
  1124. const std::set<std::string>& importedLocations)
  1125. {
  1126. // Construct the imported target name.
  1127. std::string targetName = this->Namespace;
  1128. targetName += target->GetExportName();
  1129. os << "list(APPEND _IMPORT_CHECK_TARGETS " << targetName << " )\n"
  1130. "list(APPEND _IMPORT_CHECK_FILES_FOR_" << targetName << " ";
  1131. for(std::set<std::string>::const_iterator li = importedLocations.begin();
  1132. li != importedLocations.end();
  1133. ++li)
  1134. {
  1135. ImportPropertyMap::const_iterator pi = properties.find(*li);
  1136. if (pi != properties.end())
  1137. {
  1138. os << cmExportFileGeneratorEscape(pi->second) << " ";
  1139. }
  1140. }
  1141. os << ")\n\n";
  1142. }