cmGlobalUnixMakefileGenerator3.cxx 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator3
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmGlobalUnixMakefileGenerator3.h"
  14. #include "cmLocalUnixMakefileGenerator3.h"
  15. #include "cmMakefile.h"
  16. #include "cmake.h"
  17. #include "cmGeneratedFileStream.h"
  18. #include "cmSourceFile.h"
  19. #include "cmTarget.h"
  20. cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3()
  21. {
  22. // This type of makefile always requires unix style paths
  23. this->ForceUnixPaths = true;
  24. this->FindMakeProgramFile = "CMakeUnixFindMake.cmake";
  25. this->ToolSupportsColor = true;
  26. this->NumberOfSourceFiles = 0;
  27. this->NumberOfSourceFilesWritten = 0;
  28. }
  29. void cmGlobalUnixMakefileGenerator3
  30. ::EnableLanguage(std::vector<std::string>const& languages, cmMakefile *mf)
  31. {
  32. this->cmGlobalGenerator::EnableLanguage(languages, mf);
  33. std::string path;
  34. for(std::vector<std::string>::const_iterator l = languages.begin();
  35. l != languages.end(); ++l)
  36. {
  37. if(*l == "NONE")
  38. {
  39. continue;
  40. }
  41. const char* lang = l->c_str();
  42. std::string langComp = "CMAKE_";
  43. langComp += lang;
  44. langComp += "_COMPILER";
  45. if(!mf->GetDefinition(langComp.c_str()))
  46. {
  47. cmSystemTools::Error(langComp.c_str(),
  48. " not set, after EnableLanguage");
  49. continue;
  50. }
  51. const char* name = mf->GetRequiredDefinition(langComp.c_str());
  52. if(!cmSystemTools::FileIsFullPath(name))
  53. {
  54. path = cmSystemTools::FindProgram(name);
  55. }
  56. else
  57. {
  58. path = name;
  59. }
  60. if(path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
  61. {
  62. std::string message = "your ";
  63. message += lang;
  64. message += " compiler: \"";
  65. message += name;
  66. message += "\" was not found. Please set ";
  67. message += langComp;
  68. message += " to a valid compiler path or name.";
  69. cmSystemTools::Error(message.c_str());
  70. path = name;
  71. }
  72. std::string doc = lang;
  73. doc += " compiler.";
  74. mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
  75. doc.c_str(), cmCacheManager::FILEPATH);
  76. }
  77. }
  78. ///! Create a local generator appropriate to this Global Generator
  79. cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator()
  80. {
  81. cmLocalGenerator* lg = new cmLocalUnixMakefileGenerator3;
  82. lg->SetGlobalGenerator(this);
  83. return lg;
  84. }
  85. //----------------------------------------------------------------------------
  86. void cmGlobalUnixMakefileGenerator3
  87. ::GetDocumentation(cmDocumentationEntry& entry) const
  88. {
  89. entry.name = this->GetName();
  90. entry.brief = "Generates standard UNIX makefiles.";
  91. entry.full =
  92. "A hierarchy of UNIX makefiles is generated into the build tree. Any "
  93. "standard UNIX-style make program can build the project through the "
  94. "default make target. A \"make install\" target is also provided.";
  95. }
  96. //----------------------------------------------------------------------------
  97. void
  98. cmGlobalUnixMakefileGenerator3
  99. ::AddMultipleOutputPair(const char* depender, const char* dependee)
  100. {
  101. MultipleOutputPairsType::value_type p(depender, dependee);
  102. this->MultipleOutputPairs.insert(p);
  103. }
  104. //----------------------------------------------------------------------------
  105. int cmGlobalUnixMakefileGenerator3::ShouldAddProgressRule()
  106. {
  107. // add progress to 100 source files
  108. if (this->NumberOfSourceFiles &&
  109. (((this->NumberOfSourceFilesWritten + 1)*100)/this->NumberOfSourceFiles)
  110. -(this->NumberOfSourceFilesWritten*100)/this->NumberOfSourceFiles)
  111. {
  112. this->NumberOfSourceFilesWritten++;
  113. return (this->NumberOfSourceFilesWritten*100)/this->NumberOfSourceFiles;
  114. }
  115. this->NumberOfSourceFilesWritten++;
  116. return 0;
  117. }
  118. int cmGlobalUnixMakefileGenerator3::
  119. GetNumberOfCompilableSourceFilesForTarget(cmTarget &tgt)
  120. {
  121. std::map<cmStdString, int >::iterator tgtI =
  122. this->TargetSourceFileCount.find(tgt.GetName());
  123. if (tgtI != this->TargetSourceFileCount.end())
  124. {
  125. return tgtI->second;
  126. }
  127. int result = 0;
  128. if((tgt.GetType() == cmTarget::EXECUTABLE) ||
  129. (tgt.GetType() == cmTarget::STATIC_LIBRARY) ||
  130. (tgt.GetType() == cmTarget::SHARED_LIBRARY) ||
  131. (tgt.GetType() == cmTarget::MODULE_LIBRARY) )
  132. {
  133. std::vector<cmSourceFile*>& sources = tgt.GetSourceFiles();
  134. for(std::vector<cmSourceFile*>::iterator source = sources.begin();
  135. source != sources.end(); ++source)
  136. {
  137. if(!(*source)->GetPropertyAsBool("HEADER_FILE_ONLY") &&
  138. !(*source)->GetCustomCommand())
  139. {
  140. if(!this->IgnoreFile((*source)->GetSourceExtension().c_str()))
  141. {
  142. const char* lang =
  143. static_cast<cmLocalUnixMakefileGenerator3 *>
  144. (tgt.GetMakefile()->GetLocalGenerator())
  145. ->GetSourceFileLanguage(**source);
  146. if(lang)
  147. {
  148. result++;
  149. }
  150. }
  151. }
  152. }
  153. }
  154. this->TargetSourceFileCount[tgt.GetName()] = result;
  155. return result;
  156. }
  157. //----------------------------------------------------------------------------
  158. void cmGlobalUnixMakefileGenerator3::Generate()
  159. {
  160. // initialize progress
  161. this->NumberOfSourceFiles = 0;
  162. unsigned int i;
  163. for (i = 0; i < this->LocalGenerators.size(); ++i)
  164. {
  165. // for all of out targets
  166. for (cmTargets::iterator l =
  167. this->LocalGenerators[i]->GetMakefile()->GetTargets().begin();
  168. l != this->LocalGenerators[i]->GetMakefile()->GetTargets().end();
  169. l++)
  170. {
  171. this->NumberOfSourceFiles +=
  172. this->GetNumberOfCompilableSourceFilesForTarget(l->second);
  173. }
  174. }
  175. this->NumberOfSourceFilesWritten = 0;
  176. // first do superclass method
  177. this->cmGlobalGenerator::Generate();
  178. // write the main makefile
  179. this->WriteMainMakefile2();
  180. this->WriteMainCMakefile();
  181. }
  182. void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
  183. {
  184. // Open the output file. This should not be copy-if-different
  185. // because the check-build-system step compares the makefile time to
  186. // see if the build system must be regenerated.
  187. std::string makefileName =
  188. this->GetCMakeInstance()->GetHomeOutputDirectory();
  189. makefileName += "/CMakeFiles/Makefile2";
  190. cmGeneratedFileStream makefileStream(makefileName.c_str());
  191. if(!makefileStream)
  192. {
  193. return;
  194. }
  195. // get a local generator for some useful methods
  196. cmLocalUnixMakefileGenerator3 *lg =
  197. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  198. // Write the do not edit header.
  199. lg->WriteDisclaimer(makefileStream);
  200. // Write the main entry point target. This must be the VERY first
  201. // target so that make with no arguments will run it.
  202. // Just depend on the all target to drive the build.
  203. std::vector<std::string> depends;
  204. std::vector<std::string> no_commands;
  205. depends.push_back("all");
  206. // Write the rule.
  207. lg->WriteMakeRule(makefileStream,
  208. "Default target executed when no arguments are "
  209. "given to make.",
  210. "default_target",
  211. depends,
  212. no_commands, true);
  213. depends.clear();
  214. // The all and preinstall rules might never have any dependencies
  215. // added to them.
  216. if(this->EmptyRuleHackDepends != "")
  217. {
  218. depends.push_back(this->EmptyRuleHackDepends);
  219. }
  220. // Write and empty all:
  221. lg->WriteMakeRule(makefileStream,
  222. "The main recursive all target", "all",
  223. depends, no_commands, true);
  224. // Write an empty preinstall:
  225. lg->WriteMakeRule(makefileStream,
  226. "The main recursive preinstall target", "preinstall",
  227. depends, no_commands, true);
  228. lg->WriteMakeVariables(makefileStream);
  229. // Write out the "special" stuff
  230. lg->WriteSpecialTargetsTop(makefileStream);
  231. // write the target convenience rules
  232. unsigned int i;
  233. for (i = 0; i < this->LocalGenerators.size(); ++i)
  234. {
  235. lg =
  236. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  237. // are any parents excluded
  238. bool exclude = false;
  239. cmLocalGenerator *lg3 = lg;
  240. while (lg3)
  241. {
  242. if (lg3->GetExcludeAll())
  243. {
  244. exclude = true;
  245. break;
  246. }
  247. lg3 = lg3->GetParent();
  248. }
  249. this->WriteConvenienceRules2(makefileStream,lg,exclude);
  250. }
  251. lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  252. lg->WriteSpecialTargetsBottom(makefileStream);
  253. }
  254. //----------------------------------------------------------------------------
  255. void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
  256. {
  257. // Open the output file. This should not be copy-if-different
  258. // because the check-build-system step compares the makefile time to
  259. // see if the build system must be regenerated.
  260. std::string cmakefileName =
  261. this->GetCMakeInstance()->GetHomeOutputDirectory();
  262. cmakefileName += "/CMakeFiles/Makefile.cmake";
  263. cmGeneratedFileStream cmakefileStream(cmakefileName.c_str());
  264. if(!cmakefileStream)
  265. {
  266. return;
  267. }
  268. std::string makefileName =
  269. this->GetCMakeInstance()->GetHomeOutputDirectory();
  270. makefileName += "/Makefile";
  271. // get a local generator for some useful methods
  272. cmLocalUnixMakefileGenerator3 *lg =
  273. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  274. // Write the do not edit header.
  275. lg->WriteDisclaimer(cmakefileStream);
  276. // Save the generator name
  277. cmakefileStream
  278. << "# The generator used is:\n"
  279. << "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n";
  280. // for each cmMakefile get its list of dependencies
  281. std::vector<std::string> lfiles;
  282. for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
  283. {
  284. lg =
  285. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  286. // Get the list of files contributing to this generation step.
  287. lfiles.insert(lfiles.end(),lg->GetMakefile()->GetListFiles().begin(),
  288. lg->GetMakefile()->GetListFiles().end());
  289. }
  290. // Sort the list and remove duplicates.
  291. std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
  292. std::vector<std::string>::iterator new_end =
  293. std::unique(lfiles.begin(),lfiles.end());
  294. lfiles.erase(new_end, lfiles.end());
  295. // reset lg to the first makefile
  296. lg = static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
  297. // Build the path to the cache file.
  298. std::string cache = this->GetCMakeInstance()->GetHomeOutputDirectory();
  299. cache += "/CMakeCache.txt";
  300. // Save the list to the cmake file.
  301. cmakefileStream
  302. << "# The top level Makefile was generated from the following files:\n"
  303. << "SET(CMAKE_MAKEFILE_DEPENDS\n"
  304. << " \""
  305. << lg->Convert(cache.c_str(),
  306. cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
  307. for(std::vector<std::string>::const_iterator i = lfiles.begin();
  308. i != lfiles.end(); ++i)
  309. {
  310. cmakefileStream
  311. << " \""
  312. << lg->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT).c_str()
  313. << "\"\n";
  314. }
  315. cmakefileStream
  316. << " )\n\n";
  317. // Build the path to the cache check file.
  318. std::string check = this->GetCMakeInstance()->GetHomeOutputDirectory();
  319. check += "/CMakeFiles/cmake.check_cache";
  320. // Set the corresponding makefile in the cmake file.
  321. cmakefileStream
  322. << "# The corresponding makefile is:\n"
  323. << "SET(CMAKE_MAKEFILE_OUTPUTS\n"
  324. << " \""
  325. << lg->Convert(makefileName.c_str(),
  326. cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
  327. << " \""
  328. << lg->Convert(check.c_str(),
  329. cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
  330. // add in all the directory information files
  331. std::string tmpStr;
  332. for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
  333. {
  334. lg =
  335. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  336. tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
  337. tmpStr += "/CMakeFiles/CMakeDirectoryInformation.cmake";
  338. cmakefileStream << " \"" <<
  339. lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
  340. << "\"\n";
  341. const std::vector<std::string>& outfiles =
  342. lg->GetMakefile()->GetOutputFiles();
  343. for(std::vector<std::string>::const_iterator k= outfiles.begin();
  344. k != outfiles.end(); ++k)
  345. {
  346. cmakefileStream << " \"" <<
  347. lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
  348. << "\"\n";
  349. }
  350. }
  351. cmakefileStream << " )\n\n";
  352. this->WriteMainCMakefileLanguageRules(cmakefileStream,
  353. this->LocalGenerators);
  354. if(!this->MultipleOutputPairs.empty())
  355. {
  356. cmakefileStream
  357. << "\n"
  358. << "SET(CMAKE_MULTIPLE_OUTPUT_PAIRS\n";
  359. for(MultipleOutputPairsType::const_iterator pi =
  360. this->MultipleOutputPairs.begin();
  361. pi != this->MultipleOutputPairs.end(); ++pi)
  362. {
  363. cmakefileStream << " \"" << pi->first << "\" \""
  364. << pi->second << "\"\n";
  365. }
  366. cmakefileStream << " )\n\n";
  367. }
  368. }
  369. //----------------------------------------------------------------------------
  370. void cmGlobalUnixMakefileGenerator3::CheckMultipleOutputs(cmMakefile* mf,
  371. bool verbose)
  372. {
  373. // Get the string listing the multiple output pairs.
  374. const char* pairs_string = mf->GetDefinition("CMAKE_MULTIPLE_OUTPUT_PAIRS");
  375. if(!pairs_string)
  376. {
  377. return;
  378. }
  379. // Convert the string to a list and preserve empty entries.
  380. std::vector<std::string> pairs;
  381. cmSystemTools::ExpandListArgument(pairs_string, pairs, true);
  382. for(std::vector<std::string>::const_iterator i = pairs.begin();
  383. i != pairs.end(); ++i)
  384. {
  385. const std::string& depender = *i;
  386. if(++i != pairs.end())
  387. {
  388. const std::string& dependee = *i;
  389. // If the depender is missing then delete the dependee to make
  390. // sure both will be regenerated.
  391. if(cmSystemTools::FileExists(dependee.c_str()) &&
  392. !cmSystemTools::FileExists(depender.c_str()))
  393. {
  394. if(verbose)
  395. {
  396. cmOStringStream msg;
  397. msg << "Deleting primary custom command output \"" << dependee
  398. << "\" because another output \""
  399. << depender << "\" does not exist." << std::endl;
  400. cmSystemTools::Stdout(msg.str().c_str());
  401. }
  402. cmSystemTools::RemoveFile(dependee.c_str());
  403. }
  404. }
  405. }
  406. }
  407. void cmGlobalUnixMakefileGenerator3
  408. ::WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream,
  409. std::vector<cmLocalGenerator *> &lGenerators
  410. )
  411. {
  412. cmLocalUnixMakefileGenerator3 *lg;
  413. // now list all the target info files
  414. cmakefileStream
  415. << "# The set of files whose dependency integrity should be checked:\n";
  416. cmakefileStream
  417. << "SET(CMAKE_DEPEND_INFO_FILES\n";
  418. for (unsigned int i = 0; i < lGenerators.size(); ++i)
  419. {
  420. lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
  421. // for all of out targets
  422. for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
  423. l != lg->GetMakefile()->GetTargets().end(); l++)
  424. {
  425. if((l->second.GetType() == cmTarget::EXECUTABLE) ||
  426. (l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  427. (l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  428. (l->second.GetType() == cmTarget::MODULE_LIBRARY) )
  429. {
  430. std::string tname = lg->GetRelativeTargetDirectory(l->second);
  431. tname += "/DependInfo.cmake";
  432. cmSystemTools::ConvertToUnixSlashes(tname);
  433. cmakefileStream << " \"" << tname.c_str() << "\"\n";
  434. }
  435. }
  436. }
  437. cmakefileStream << " )\n";
  438. }
  439. //----------------------------------------------------------------------------
  440. void
  441. cmGlobalUnixMakefileGenerator3
  442. ::WriteDirectoryRule2(std::ostream& ruleFileStream,
  443. cmLocalUnixMakefileGenerator3* lg,
  444. const char* pass, bool check_all,
  445. bool check_relink)
  446. {
  447. // Get the relative path to the subdirectory from the top.
  448. std::string makeTarget = lg->GetMakefile()->GetStartOutputDirectory();
  449. makeTarget += "/";
  450. makeTarget += pass;
  451. makeTarget = lg->Convert(makeTarget.c_str(),
  452. cmLocalGenerator::HOME_OUTPUT,
  453. cmLocalGenerator::MAKEFILE);
  454. // The directory-level rule should depend on the target-level rules
  455. // for all targets in the directory.
  456. std::vector<std::string> depends;
  457. for(cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin();
  458. l != lg->GetMakefile()->GetTargets().end(); ++l)
  459. {
  460. if((l->second.GetType() == cmTarget::EXECUTABLE) ||
  461. (l->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  462. (l->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  463. (l->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  464. (l->second.GetType() == cmTarget::UTILITY))
  465. {
  466. // Add this to the list of depends rules in this directory.
  467. if((!check_all || l->second.IsInAll()) &&
  468. (!check_relink || l->second.NeedRelinkBeforeInstall()))
  469. {
  470. std::string tname = lg->GetRelativeTargetDirectory(l->second);
  471. tname += "/";
  472. tname += pass;
  473. depends.push_back(tname);
  474. }
  475. }
  476. }
  477. // The directory-level rule should depend on the directory-level
  478. // rules of the subdirectories.
  479. for(std::vector<cmLocalGenerator*>::iterator sdi =
  480. lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi)
  481. {
  482. cmLocalUnixMakefileGenerator3* slg =
  483. static_cast<cmLocalUnixMakefileGenerator3*>(*sdi);
  484. std::string subdir = slg->GetMakefile()->GetStartOutputDirectory();
  485. subdir += "/";
  486. subdir += pass;
  487. subdir = slg->Convert(subdir.c_str(),
  488. cmLocalGenerator::HOME_OUTPUT,
  489. cmLocalGenerator::MAKEFILE);
  490. depends.push_back(subdir);
  491. }
  492. // Work-around for makes that drop rules that have no dependencies
  493. // or commands.
  494. if(depends.empty() && this->EmptyRuleHackDepends != "")
  495. {
  496. depends.push_back(this->EmptyRuleHackDepends);
  497. }
  498. // Write the rule.
  499. std::string doc = "Convenience name for \"";
  500. doc += pass;
  501. doc += "\" pass in the directory.";
  502. std::vector<std::string> no_commands;
  503. lg->WriteMakeRule(ruleFileStream, doc.c_str(),
  504. makeTarget.c_str(), depends, no_commands, true);
  505. }
  506. //----------------------------------------------------------------------------
  507. void
  508. cmGlobalUnixMakefileGenerator3
  509. ::WriteDirectoryRules2(std::ostream& ruleFileStream,
  510. cmLocalUnixMakefileGenerator3* lg)
  511. {
  512. // Only subdirectories need these rules.
  513. if(!lg->GetParent())
  514. {
  515. return;
  516. }
  517. // Begin the directory-level rules section.
  518. std::string dir = lg->GetMakefile()->GetStartOutputDirectory();
  519. dir = lg->Convert(dir.c_str(), cmLocalGenerator::HOME_OUTPUT,
  520. cmLocalGenerator::MAKEFILE);
  521. lg->WriteDivider(ruleFileStream);
  522. ruleFileStream
  523. << "# Directory level rules for directory "
  524. << dir << "\n\n";
  525. // Write directory-level rules for "all".
  526. this->WriteDirectoryRule2(ruleFileStream, lg, "all", true, false);
  527. // Write directory-level rules for "clean".
  528. this->WriteDirectoryRule2(ruleFileStream, lg, "clean", false, false);
  529. // Write directory-level rules for "preinstall".
  530. this->WriteDirectoryRule2(ruleFileStream, lg, "preinstall", false, true);
  531. }
  532. std::string cmGlobalUnixMakefileGenerator3
  533. ::GenerateBuildCommand(const char* makeProgram, const char *projectName,
  534. const char* additionalOptions, const char *targetName,
  535. const char* config, bool ignoreErrors, bool fast)
  536. {
  537. // Project name and config are not used yet.
  538. (void)projectName;
  539. (void)config;
  540. std::string makeCommand =
  541. cmSystemTools::ConvertToUnixOutputPath(makeProgram);
  542. // Since we have full control over the invocation of nmake, let us
  543. // make it quiet.
  544. if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
  545. {
  546. makeCommand += " /NOLOGO ";
  547. }
  548. if ( ignoreErrors )
  549. {
  550. makeCommand += " -i";
  551. }
  552. if ( additionalOptions )
  553. {
  554. makeCommand += " ";
  555. makeCommand += additionalOptions;
  556. }
  557. if ( targetName && strlen(targetName))
  558. {
  559. cmLocalUnixMakefileGenerator3 *lg;
  560. if (this->LocalGenerators.size())
  561. {
  562. lg = static_cast<cmLocalUnixMakefileGenerator3 *>
  563. (this->LocalGenerators[0]);
  564. }
  565. else
  566. {
  567. lg = static_cast<cmLocalUnixMakefileGenerator3 *>
  568. (this->CreateLocalGenerator());
  569. // set the Start directories
  570. lg->GetMakefile()->SetStartDirectory
  571. (this->CMakeInstance->GetStartDirectory());
  572. lg->GetMakefile()->SetStartOutputDirectory
  573. (this->CMakeInstance->GetStartOutputDirectory());
  574. lg->GetMakefile()->MakeStartDirectoriesCurrent();
  575. }
  576. lg->SetupPathConversions();
  577. makeCommand += " \"";
  578. std::string tname = targetName;
  579. if(fast)
  580. {
  581. tname += "/fast";
  582. }
  583. tname = lg->Convert(tname.c_str(),cmLocalGenerator::HOME_OUTPUT,
  584. cmLocalGenerator::MAKEFILE);
  585. tname = lg->ConvertToMakeTarget(tname.c_str());
  586. makeCommand += tname.c_str();
  587. makeCommand += "\"";
  588. if (!this->LocalGenerators.size())
  589. {
  590. delete lg;
  591. }
  592. }
  593. return makeCommand;
  594. }
  595. //----------------------------------------------------------------------------
  596. void
  597. cmGlobalUnixMakefileGenerator3
  598. ::WriteConvenienceRules(std::ostream& ruleFileStream,
  599. std::set<cmStdString> &emitted)
  600. {
  601. std::vector<std::string> depends;
  602. std::vector<std::string> commands;
  603. depends.push_back("cmake_check_build_system");
  604. // write the target convenience rules
  605. unsigned int i;
  606. cmLocalUnixMakefileGenerator3 *lg;
  607. for (i = 0; i < this->LocalGenerators.size(); ++i)
  608. {
  609. lg = static_cast<cmLocalUnixMakefileGenerator3 *>
  610. (this->LocalGenerators[i]);
  611. // for each target Generate the rule files for each target.
  612. cmTargets& targets = lg->GetMakefile()->GetTargets();
  613. for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
  614. {
  615. // Don't emit the same rule twice (e.g. two targets with the same
  616. // simple name)
  617. if(t->second.GetName() &&
  618. strlen(t->second.GetName()) &&
  619. emitted.insert(t->second.GetName()).second)
  620. {
  621. // Handle user targets here. Global targets are handled in
  622. // the local generator on a per-directory basis.
  623. if((t->second.GetType() == cmTarget::EXECUTABLE) ||
  624. (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  625. (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  626. (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  627. (t->second.GetType() == cmTarget::UTILITY))
  628. {
  629. // Add a rule to build the target by name.
  630. lg->WriteDivider(ruleFileStream);
  631. ruleFileStream
  632. << "# Target rules for targets named "
  633. << t->second.GetName() << "\n\n";
  634. // Write the rule.
  635. commands.clear();
  636. std::string progressDir =
  637. lg->GetMakefile()->GetHomeOutputDirectory();
  638. progressDir += "/CMakeFiles";
  639. {
  640. // TODO: Convert the total progress count to a make variable.
  641. cmOStringStream progCmd;
  642. progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
  643. // # in target
  644. progCmd << lg->Convert(progressDir.c_str(),
  645. cmLocalGenerator::FULL,
  646. cmLocalGenerator::SHELL);
  647. int n = this->GetNumberOfSourceFiles();
  648. if(n > 100)
  649. {
  650. n = 100;
  651. }
  652. if (this->NumberOfSourceFiles)
  653. {
  654. progCmd << " " <<
  655. (n*this->GetTargetTotalNumberOfSourceFiles(t->second))/
  656. this->NumberOfSourceFiles;
  657. }
  658. else
  659. {
  660. progCmd << " 0";
  661. }
  662. commands.push_back(progCmd.str());
  663. }
  664. commands.push_back(lg->GetRecursiveMakeCall
  665. ("CMakeFiles/Makefile2",t->second.GetName()));
  666. {
  667. cmOStringStream progCmd;
  668. progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
  669. progCmd << lg->Convert(progressDir.c_str(),
  670. cmLocalGenerator::FULL,
  671. cmLocalGenerator::SHELL);
  672. progCmd << " 0";
  673. commands.push_back(progCmd.str());
  674. }
  675. depends.clear();
  676. depends.push_back("cmake_check_build_system");
  677. lg->WriteMakeRule(ruleFileStream,
  678. "Build rule for target.",
  679. t->second.GetName(), depends, commands,
  680. true);
  681. // Add a fast rule to build the target
  682. std::string localName = lg->GetRelativeTargetDirectory(t->second);
  683. std::string makefileName;
  684. makefileName = localName;
  685. makefileName += "/build.make";
  686. depends.clear();
  687. commands.clear();
  688. std::string makeTargetName = localName;
  689. makeTargetName += "/build";
  690. localName = t->second.GetName();
  691. localName += "/fast";
  692. commands.push_back(lg->GetRecursiveMakeCall
  693. (makefileName.c_str(), makeTargetName.c_str()));
  694. lg->WriteMakeRule(ruleFileStream, "fast build rule for target.",
  695. localName.c_str(), depends, commands, true);
  696. }
  697. }
  698. }
  699. }
  700. }
  701. //----------------------------------------------------------------------------
  702. void
  703. cmGlobalUnixMakefileGenerator3
  704. ::WriteConvenienceRules2(std::ostream& ruleFileStream,
  705. cmLocalUnixMakefileGenerator3 *lg,
  706. bool exclude)
  707. {
  708. std::vector<std::string> depends;
  709. std::vector<std::string> commands;
  710. std::string localName;
  711. std::string makeTargetName;
  712. // write the directory level rules for this local gen
  713. this->WriteDirectoryRules2(ruleFileStream,lg);
  714. depends.push_back("cmake_check_build_system");
  715. // for each target Generate the rule files for each target.
  716. cmTargets& targets = lg->GetMakefile()->GetTargets();
  717. for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
  718. {
  719. if (t->second.GetName() && strlen(t->second.GetName()))
  720. {
  721. std::string makefileName;
  722. // Add a rule to build the target by name.
  723. localName = lg->GetRelativeTargetDirectory(t->second);
  724. makefileName = localName;
  725. makefileName += "/build.make";
  726. if (((t->second.GetType() == cmTarget::EXECUTABLE) ||
  727. (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  728. (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  729. (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  730. (t->second.GetType() == cmTarget::UTILITY)))
  731. {
  732. bool needRequiresStep =
  733. this->NeedRequiresStep(lg,t->second.GetName());
  734. lg->WriteDivider(ruleFileStream);
  735. ruleFileStream
  736. << "# Target rules for target "
  737. << localName << "\n\n";
  738. commands.clear();
  739. if (t->second.GetType() != cmTarget::UTILITY)
  740. {
  741. makeTargetName = localName;
  742. makeTargetName += "/depend";
  743. commands.push_back(lg->GetRecursiveMakeCall
  744. (makefileName.c_str(),makeTargetName.c_str()));
  745. // add requires if we need it for this generator
  746. if (needRequiresStep)
  747. {
  748. makeTargetName = localName;
  749. makeTargetName += "/requires";
  750. commands.push_back(lg->GetRecursiveMakeCall
  751. (makefileName.c_str(),makeTargetName.c_str()));
  752. }
  753. }
  754. makeTargetName = localName;
  755. makeTargetName += "/build";
  756. commands.push_back(lg->GetRecursiveMakeCall
  757. (makefileName.c_str(),makeTargetName.c_str()));
  758. // Write the rule.
  759. localName += "/all";
  760. depends.clear();
  761. std::string progressDir =
  762. lg->GetMakefile()->GetHomeOutputDirectory();
  763. progressDir += "/CMakeFiles";
  764. cmOStringStream progCmd;
  765. progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report ";
  766. // all target counts
  767. progCmd << lg->Convert(progressDir.c_str(),
  768. cmLocalGenerator::FULL,
  769. cmLocalGenerator::SHELL);
  770. progCmd << " ";
  771. std::vector<int> &progFiles = lg->ProgressFiles[t->first];
  772. for (std::vector<int>::iterator i = progFiles.begin();
  773. i != progFiles.end(); ++i)
  774. {
  775. progCmd << " " << *i;
  776. }
  777. commands.push_back(progCmd.str());
  778. progressDir = "Building target ";
  779. progressDir += t->first;
  780. lg->AppendEcho(commands,progressDir.c_str());
  781. this->AppendGlobalTargetDepends(depends,t->second);
  782. lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
  783. localName.c_str(), depends, commands, true);
  784. // add the all/all dependency
  785. if (!exclude && t->second.IsInAll())
  786. {
  787. depends.clear();
  788. depends.push_back(localName);
  789. commands.clear();
  790. lg->WriteMakeRule(ruleFileStream, "Include target in all.",
  791. "all", depends, commands, true);
  792. }
  793. // Write the rule.
  794. commands.clear();
  795. commands.push_back(lg->GetRecursiveMakeCall
  796. ("CMakeFiles/Makefile2",localName.c_str()));
  797. depends.clear();
  798. depends.push_back("cmake_check_build_system");
  799. localName = lg->GetRelativeTargetDirectory(t->second);
  800. localName += "/rule";
  801. lg->WriteMakeRule(ruleFileStream,
  802. "Build rule for subdir invocation for target.",
  803. localName.c_str(), depends, commands, true);
  804. // Add a target with the canonical name (no prefix, suffix or path).
  805. commands.clear();
  806. depends.clear();
  807. depends.push_back(localName);
  808. lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
  809. t->second.GetName(), depends, commands, true);
  810. // Add rules to prepare the target for installation.
  811. if(t->second.NeedRelinkBeforeInstall())
  812. {
  813. localName = lg->GetRelativeTargetDirectory(t->second);
  814. localName += "/preinstall";
  815. depends.clear();
  816. commands.clear();
  817. commands.push_back(lg->GetRecursiveMakeCall
  818. (makefileName.c_str(), localName.c_str()));
  819. this->AppendGlobalTargetDepends(depends,t->second);
  820. lg->WriteMakeRule(ruleFileStream,
  821. "Pre-install relink rule for target.",
  822. localName.c_str(), depends, commands, true);
  823. depends.clear();
  824. depends.push_back(localName);
  825. commands.clear();
  826. lg->WriteMakeRule(ruleFileStream, "Prepare target for install.",
  827. "preinstall", depends, commands, true);
  828. }
  829. // add the clean rule
  830. localName = lg->GetRelativeTargetDirectory(t->second);
  831. makeTargetName = localName;
  832. makeTargetName += "/clean";
  833. depends.clear();
  834. commands.clear();
  835. commands.push_back(lg->GetRecursiveMakeCall
  836. (makefileName.c_str(), makeTargetName.c_str()));
  837. lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
  838. makeTargetName.c_str(), depends, commands, true);
  839. commands.clear();
  840. depends.push_back(makeTargetName);
  841. lg->WriteMakeRule(ruleFileStream, "clean rule for target.",
  842. "clean", depends, commands, true);
  843. }
  844. }
  845. }
  846. }
  847. //----------------------------------------------------------------------------
  848. int cmGlobalUnixMakefileGenerator3
  849. ::GetTargetTotalNumberOfSourceFiles(cmTarget& target)
  850. {
  851. int result = this->GetNumberOfCompilableSourceFilesForTarget(target);
  852. std::vector<cmTarget *>& depends = this->GetTargetDepends(target);
  853. std::vector<cmTarget *>::iterator i;
  854. for (i = depends.begin(); i != depends.end(); ++i)
  855. {
  856. result += this->GetTargetTotalNumberOfSourceFiles(**i);
  857. }
  858. return result;
  859. }
  860. //----------------------------------------------------------------------------
  861. std::vector<cmTarget *>& cmGlobalUnixMakefileGenerator3
  862. ::GetTargetDepends(cmTarget& target)
  863. {
  864. // if the depends are already in the map then return
  865. std::map<cmStdString, std::vector<cmTarget *> >::iterator tgtI =
  866. this->TargetDependencies.find(target.GetName());
  867. if (tgtI != this->TargetDependencies.end())
  868. {
  869. return tgtI->second;
  870. }
  871. // A target should not depend on itself.
  872. std::set<cmStdString> emitted;
  873. emitted.insert(target.GetName());
  874. // the vector of results
  875. std::vector<cmTarget *>& result =
  876. this->TargetDependencies[target.GetName()];
  877. // Loop over all library dependencies but not for static libs
  878. if (target.GetType() != cmTarget::STATIC_LIBRARY)
  879. {
  880. const cmTarget::LinkLibraryVectorType& tlibs = target.GetLinkLibraries();
  881. for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
  882. lib != tlibs.end(); ++lib)
  883. {
  884. // Don't emit the same library twice for this target.
  885. if(emitted.insert(lib->first).second)
  886. {
  887. cmTarget *target2 =
  888. target.GetMakefile()->FindTarget(lib->first.c_str());
  889. // search each local generator until a match is found
  890. if (!target2)
  891. {
  892. target2 = this->FindTarget(0,lib->first.c_str());
  893. }
  894. // if a match was found then ...
  895. if (target2)
  896. {
  897. // Add this dependency.
  898. result.push_back(target2);
  899. }
  900. }
  901. }
  902. }
  903. // Loop over all utility dependencies.
  904. const std::set<cmStdString>& tutils = target.GetUtilities();
  905. for(std::set<cmStdString>::const_iterator util = tutils.begin();
  906. util != tutils.end(); ++util)
  907. {
  908. // Don't emit the same utility twice for this target.
  909. if(emitted.insert(*util).second)
  910. {
  911. cmTarget *target2 = target.GetMakefile()->FindTarget(util->c_str());
  912. // search each local generator until a match is found
  913. if (!target2)
  914. {
  915. target2 = this->FindTarget(0,util->c_str());
  916. }
  917. // if a match was found then ...
  918. if (target2)
  919. {
  920. // Add this dependency.
  921. result.push_back(target2);
  922. }
  923. }
  924. }
  925. return result;
  926. }
  927. //----------------------------------------------------------------------------
  928. void
  929. cmGlobalUnixMakefileGenerator3
  930. ::AppendGlobalTargetDepends(std::vector<std::string>& depends,
  931. cmTarget& target)
  932. {
  933. // Keep track of dependencies already listed.
  934. std::set<cmStdString> emitted;
  935. // A target should not depend on itself.
  936. emitted.insert(target.GetName());
  937. // Loop over all library dependencies but not for static libs
  938. if (target.GetType() != cmTarget::STATIC_LIBRARY)
  939. {
  940. const cmTarget::LinkLibraryVectorType& tlibs = target.GetLinkLibraries();
  941. for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
  942. lib != tlibs.end(); ++lib)
  943. {
  944. // Don't emit the same library twice for this target.
  945. if(emitted.insert(lib->first).second)
  946. {
  947. // Add this dependency.
  948. this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
  949. emitted, target);
  950. }
  951. }
  952. }
  953. // Loop over all utility dependencies.
  954. const std::set<cmStdString>& tutils = target.GetUtilities();
  955. for(std::set<cmStdString>::const_iterator util = tutils.begin();
  956. util != tutils.end(); ++util)
  957. {
  958. // Don't emit the same utility twice for this target.
  959. if(emitted.insert(*util).second)
  960. {
  961. // Add this dependency.
  962. this->AppendAnyGlobalDepend(depends, util->c_str(), emitted, target);
  963. }
  964. }
  965. }
  966. //----------------------------------------------------------------------------
  967. void
  968. cmGlobalUnixMakefileGenerator3
  969. ::AppendAnyGlobalDepend(std::vector<std::string>& depends, const char* name,
  970. std::set<cmStdString>& emitted, cmTarget &target)
  971. {
  972. cmTarget *result;
  973. cmLocalUnixMakefileGenerator3 *lg3;
  974. // first check the same dir as the current target
  975. lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>
  976. (target.GetMakefile()->GetLocalGenerator());
  977. result = target.GetMakefile()->FindTarget(name);
  978. // search each local generator until a match is found
  979. if (!result)
  980. {
  981. result = this->FindTarget(0,name);
  982. if (result)
  983. {
  984. lg3 = static_cast<cmLocalUnixMakefileGenerator3 *>
  985. (result->GetMakefile()->GetLocalGenerator());
  986. }
  987. }
  988. // if a match was found then ...
  989. if (result)
  990. {
  991. std::string tgtName = lg3->GetRelativeTargetDirectory(*result);
  992. tgtName += "/all";
  993. depends.push_back(tgtName);
  994. if(result->GetType() == cmTarget::STATIC_LIBRARY)
  995. {
  996. const cmTarget::LinkLibraryVectorType& tlibs
  997. = result->GetLinkLibraries();
  998. for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
  999. lib != tlibs.end(); ++lib)
  1000. {
  1001. // Don't emit the same library twice for this target.
  1002. if(emitted.insert(lib->first).second)
  1003. {
  1004. // Add this dependency.
  1005. this->AppendAnyGlobalDepend(depends, lib->first.c_str(),
  1006. emitted, *result);
  1007. }
  1008. }
  1009. }
  1010. return;
  1011. }
  1012. }
  1013. //----------------------------------------------------------------------------
  1014. void cmGlobalUnixMakefileGenerator3::WriteHelpRule
  1015. (std::ostream& ruleFileStream, cmLocalUnixMakefileGenerator3 *lg)
  1016. {
  1017. // add the help target
  1018. std::string path;
  1019. std::vector<std::string> no_depends;
  1020. std::vector<std::string> commands;
  1021. lg->AppendEcho(commands,"The following are some of the valid targets "
  1022. "for this Makefile:");
  1023. lg->AppendEcho(commands,"... all (the default if no target is provided)");
  1024. lg->AppendEcho(commands,"... clean");
  1025. lg->AppendEcho(commands,"... depend");
  1026. // Keep track of targets already listed.
  1027. std::set<cmStdString> emittedTargets;
  1028. // for each local generator
  1029. unsigned int i;
  1030. cmLocalUnixMakefileGenerator3 *lg2;
  1031. for (i = 0; i < this->LocalGenerators.size(); ++i)
  1032. {
  1033. lg2 =
  1034. static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
  1035. // for the passed in makefile or if this is the top Makefile wripte out
  1036. // the targets
  1037. if (lg2 == lg || !lg->GetParent())
  1038. {
  1039. // for each target Generate the rule files for each target.
  1040. cmTargets& targets = lg2->GetMakefile()->GetTargets();
  1041. for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
  1042. {
  1043. if((t->second.GetType() == cmTarget::EXECUTABLE) ||
  1044. (t->second.GetType() == cmTarget::STATIC_LIBRARY) ||
  1045. (t->second.GetType() == cmTarget::SHARED_LIBRARY) ||
  1046. (t->second.GetType() == cmTarget::MODULE_LIBRARY) ||
  1047. (t->second.GetType() == cmTarget::GLOBAL_TARGET) ||
  1048. (t->second.GetType() == cmTarget::UTILITY))
  1049. {
  1050. if(emittedTargets.insert(t->second.GetName()).second)
  1051. {
  1052. path = "... ";
  1053. path += t->second.GetName();
  1054. lg->AppendEcho(commands,path.c_str());
  1055. }
  1056. }
  1057. }
  1058. std::map<cmStdString,std::vector<cmTarget *> > const& objs =
  1059. lg->GetLocalObjectFiles();
  1060. for(std::map<cmStdString,std::vector<cmTarget *> >::const_iterator o =
  1061. objs.begin(); o != objs.end(); ++o)
  1062. {
  1063. path = "... ";
  1064. path += o->first;
  1065. lg->AppendEcho(commands, path.c_str());
  1066. }
  1067. }
  1068. }
  1069. lg->WriteMakeRule(ruleFileStream, "Help Target",
  1070. "help:",
  1071. no_depends, commands, true);
  1072. ruleFileStream << "\n\n";
  1073. }
  1074. bool cmGlobalUnixMakefileGenerator3
  1075. ::NeedRequiresStep(cmLocalUnixMakefileGenerator3 *lg,const char *name)
  1076. {
  1077. std::map<cmStdString,cmLocalUnixMakefileGenerator3::IntegrityCheckSet>&
  1078. checkSet = lg->GetIntegrityCheckSet()[name];
  1079. for(std::map<cmStdString,
  1080. cmLocalUnixMakefileGenerator3::IntegrityCheckSet>::const_iterator
  1081. l = checkSet.begin(); l != checkSet.end(); ++l)
  1082. {
  1083. std::string name2 = "CMAKE_NEEDS_REQUIRES_STEP_";
  1084. name2 += l->first;
  1085. name2 += "_FLAG";
  1086. if(lg->GetMakefile()->GetDefinition(name2.c_str()))
  1087. {
  1088. return true;
  1089. }
  1090. }
  1091. return false;
  1092. }