cmGlobalGenerator.cxx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  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 "cmGlobalGenerator.h"
  14. #include "cmLocalGenerator.h"
  15. #include "cmake.h"
  16. #include "cmMakefile.h"
  17. #include <stdlib.h> // required for atof
  18. #if defined(_WIN32) && !defined(__CYGWIN__)
  19. #include <windows.h>
  20. #endif
  21. int cmGlobalGenerator::s_TryCompileTimeout = 0;
  22. cmGlobalGenerator::cmGlobalGenerator()
  23. {
  24. // by default use the native paths
  25. m_ForceUnixPaths = false;
  26. }
  27. cmGlobalGenerator::~cmGlobalGenerator()
  28. {
  29. // Delete any existing cmLocalGenerators
  30. unsigned int i;
  31. for (i = 0; i < m_LocalGenerators.size(); ++i)
  32. {
  33. delete m_LocalGenerators[i];
  34. }
  35. m_LocalGenerators.clear();
  36. }
  37. // Find the make program for the generator, required for try compiles
  38. void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
  39. {
  40. if(m_FindMakeProgramFile.size() == 0)
  41. {
  42. cmSystemTools::Error(
  43. "Generator implementation error, "
  44. "all generators must specify m_FindMakeProgramFile");
  45. }
  46. if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
  47. || cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
  48. {
  49. std::string setMakeProgram = mf->GetModulesFile(m_FindMakeProgramFile.c_str());
  50. if(setMakeProgram.size())
  51. {
  52. mf->ReadListFile(0, setMakeProgram.c_str());
  53. }
  54. }
  55. if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM")
  56. || cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM")))
  57. {
  58. cmOStringStream err;
  59. err << "CMake was unable to find a build program corresponding to \""
  60. << this->GetName() << "\". CMAKE_MAKE_PROGRAM is not set. You "
  61. << "probably need to select a different build tool.";
  62. cmSystemTools::Error(err.str().c_str());
  63. cmSystemTools::SetFatalErrorOccured();
  64. return;
  65. }
  66. std::string makeProgram = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
  67. // if there are spaces in the make program use short path
  68. // but do not short path the actual program name, as
  69. // this can cause trouble with VSExpress
  70. if(makeProgram.find(' ') != makeProgram.npos)
  71. {
  72. std::string dir;
  73. std::string file;
  74. cmSystemTools::SplitProgramPath(makeProgram.c_str(),
  75. dir, file);
  76. std::string saveFile = file;
  77. cmSystemTools::GetShortPath(makeProgram.c_str(), makeProgram);
  78. cmSystemTools::SplitProgramPath(makeProgram.c_str(),
  79. dir, file);
  80. makeProgram = dir;
  81. makeProgram += "/";
  82. makeProgram += saveFile;
  83. this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", makeProgram.c_str(),
  84. "make program",
  85. cmCacheManager::FILEPATH);
  86. }
  87. }
  88. // enable the given language
  89. void cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
  90. cmMakefile *mf)
  91. {
  92. if(languages.size() == 0)
  93. {
  94. cmSystemTools::Error("EnableLanguage must have a lang specified!");
  95. cmSystemTools::SetFatalErrorOccured();
  96. return;
  97. }
  98. // setup some variables for the EnableLanguage function
  99. bool isLocal = m_CMakeInstance->GetLocal();
  100. // if we are from the top, always define this
  101. if(!isLocal)
  102. {
  103. mf->AddDefinition("RUN_CONFIGURE", true);
  104. }
  105. bool needTestLanguage = false;
  106. std::string rootBin = mf->GetHomeOutputDirectory();
  107. if(m_ConfiguredFilesPath.size())
  108. {
  109. rootBin = m_ConfiguredFilesPath;
  110. }
  111. // **** Step 1, find and make sure CMAKE_MAKE_PROGRAM is defined
  112. this->FindMakeProgram(mf);
  113. // **** Step 2, Load the CMakeDetermineSystem.cmake file and find out
  114. // what platform we are running on
  115. if (!isLocal && !mf->GetDefinition("CMAKE_SYSTEM_NAME"))
  116. {
  117. #if defined(_WIN32) && !defined(__CYGWIN__)
  118. /* Windows version number data. */
  119. OSVERSIONINFO osvi;
  120. ZeroMemory(&osvi, sizeof(osvi));
  121. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  122. GetVersionEx (&osvi);
  123. cmOStringStream windowsVersionString;
  124. windowsVersionString << osvi.dwMajorVersion << "." << osvi.dwMinorVersion;
  125. windowsVersionString.str();
  126. mf->AddDefinition("CMAKE_SYSTEM_VERSION", windowsVersionString.str().c_str());
  127. #endif
  128. // Read the DetermineSystem file
  129. std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake");
  130. mf->ReadListFile(0, systemFile.c_str());
  131. }
  132. // **** Step 3, load the CMakeSystem.cmake from the binary directory
  133. // this file is configured by the CMakeDetermineSystem.cmake file
  134. std::string fpath = rootBin;
  135. if(!mf->GetDefinition("CMAKE_SYSTEM_LOADED"))
  136. {
  137. fpath += "/CMakeSystem.cmake";
  138. mf->ReadListFile(0,fpath.c_str());
  139. }
  140. // **** Step 4, foreach language
  141. // load the CMakeDetermine(LANG)Compiler.cmake file to find
  142. // the compiler
  143. for(std::vector<std::string>::const_iterator l = languages.begin();
  144. l != languages.end(); ++l)
  145. {
  146. const char* lang = l->c_str();
  147. if(!isLocal && !this->GetLanguageEnabled(lang) )
  148. {
  149. if (m_CMakeInstance->GetIsInTryCompile())
  150. {
  151. cmSystemTools::Error("This should not have happen. "
  152. "If you see this message, you are probably using a "
  153. "broken CMakeLists.txt file or a problematic release of "
  154. "CMake");
  155. }
  156. needTestLanguage = true; // must test a language after finding it
  157. // read determine LANG compiler
  158. std::string determinCompiler = "CMakeDetermine";
  159. determinCompiler += lang;
  160. determinCompiler += "Compiler.cmake";
  161. std::string determineFile = mf->GetModulesFile(determinCompiler.c_str());
  162. if(!mf->ReadListFile(0,determineFile.c_str()))
  163. {
  164. cmSystemTools::Error("Could not find cmake module file:", determineFile.c_str());
  165. }
  166. this->SetLanguageEnabled(lang);
  167. // put ${CMake_(LANG)_COMPILER_ENV_VAR}=${CMAKE_(LANG)_COMPILER into the
  168. // environment, in case user scripts want to run configure, or sub cmakes
  169. std::string compilerName = "CMAKE_";
  170. compilerName += lang;
  171. compilerName += "_COMPILER";
  172. std::string compilerEnv = "CMAKE_";
  173. compilerEnv += lang;
  174. compilerEnv += "_COMPILER_ENV_VAR";
  175. std::string envVar = mf->GetRequiredDefinition(compilerEnv.c_str());
  176. std::string envVarValue = mf->GetRequiredDefinition(compilerName.c_str());
  177. std::string env = envVar;
  178. env += "=";
  179. env += envVarValue;
  180. cmSystemTools::PutEnv(env.c_str());
  181. }
  182. // **** Step 5, Load the configured language compiler file, if not loaded.
  183. // look to see if CMAKE_(LANG)_COMPILER_LOADED is set,
  184. // if not then load the CMake(LANG)Compiler.cmake file from the
  185. // binary tree, this is a configured file provided by
  186. // CMakeDetermine(LANG)Compiler.cmake
  187. std::string loadedLang = "CMAKE_";
  188. loadedLang += lang;
  189. loadedLang += "_COMPILER_LOADED";
  190. if(!mf->GetDefinition(loadedLang.c_str()))
  191. {
  192. fpath = rootBin;
  193. fpath += "/CMake";
  194. fpath += lang;
  195. fpath += "Compiler.cmake";
  196. if(!mf->ReadListFile(0,fpath.c_str()))
  197. {
  198. cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
  199. }
  200. this->SetLanguageEnabled(lang);
  201. }
  202. }
  203. // **** Step 6, Load the system specific information if not yet loaded
  204. if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED"))
  205. {
  206. fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake");
  207. if(!mf->ReadListFile(0,fpath.c_str()))
  208. {
  209. cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
  210. }
  211. }
  212. for(std::vector<std::string>::const_iterator l = languages.begin();
  213. l != languages.end(); ++l)
  214. {
  215. const char* lang = l->c_str();
  216. std::string langLoadedVar = "CMAKE_";
  217. langLoadedVar += lang;
  218. langLoadedVar += "_INFORMATION_LOADED";
  219. if (!mf->GetDefinition(langLoadedVar.c_str()))
  220. {
  221. fpath = "CMake";
  222. fpath += lang;
  223. fpath += "Information.cmake";
  224. fpath = mf->GetModulesFile(fpath.c_str());
  225. if(!mf->ReadListFile(0,fpath.c_str()))
  226. {
  227. cmSystemTools::Error("Could not find cmake module file:", fpath.c_str());
  228. }
  229. }
  230. // **** Step 7, Test the compiler for the language just setup
  231. // At this point we should have enough info for a try compile
  232. // which is used in the backward stuff
  233. if(!isLocal)
  234. {
  235. if(needTestLanguage)
  236. {
  237. if (!m_CMakeInstance->GetIsInTryCompile())
  238. {
  239. std::string testLang = "CMakeTest";
  240. testLang += lang;
  241. testLang += "Compiler.cmake";
  242. std::string ifpath = mf->GetModulesFile(testLang.c_str());
  243. if(!mf->ReadListFile(0,ifpath.c_str()))
  244. {
  245. cmSystemTools::Error("Could not find cmake module file:", ifpath.c_str());
  246. }
  247. // **** Step 8, load backwards compatibility stuff for C and CXX
  248. // for old versions of CMake ListFiles C and CXX had some
  249. // backwards compatibility files they have to load
  250. const char* versionValue
  251. = mf->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
  252. if (atof(versionValue) <= 1.4)
  253. {
  254. if(strcmp(lang, "C") == 0)
  255. {
  256. ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityC.cmake");
  257. mf->ReadListFile(0,ifpath.c_str());
  258. }
  259. if(strcmp(lang, "CXX") == 0)
  260. {
  261. ifpath = mf->GetModulesFile("CMakeBackwardCompatibilityCXX.cmake");
  262. mf->ReadListFile(0,ifpath.c_str());
  263. }
  264. }
  265. }
  266. }
  267. }
  268. }
  269. }
  270. void cmGlobalGenerator::SetLanguageEnabled(const char* l)
  271. {
  272. m_LanguageEnabled[l] = true;
  273. }
  274. bool cmGlobalGenerator::GetLanguageEnabled(const char* l)
  275. {
  276. return (m_LanguageEnabled.count(l) > 0);
  277. }
  278. void cmGlobalGenerator::ClearEnabledLanguages()
  279. {
  280. m_LanguageEnabled.clear();
  281. }
  282. void cmGlobalGenerator::Configure()
  283. {
  284. // Delete any existing cmLocalGenerators
  285. unsigned int i;
  286. for (i = 0; i < m_LocalGenerators.size(); ++i)
  287. {
  288. delete m_LocalGenerators[i];
  289. }
  290. m_LocalGenerators.clear();
  291. // start with this directory
  292. cmLocalGenerator *lg = this->CreateLocalGenerator();
  293. m_LocalGenerators.push_back(lg);
  294. // set the Start directories
  295. lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory());
  296. lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory());
  297. lg->GetMakefile()->MakeStartDirectoriesCurrent();
  298. // now do it
  299. this->RecursiveConfigure(lg,0.0f,0.9f);
  300. std::set<std::string> notFoundMap;
  301. // after it is all done do a ConfigureFinalPass
  302. cmCacheManager* manager = 0;
  303. for (i = 0; i < m_LocalGenerators.size(); ++i)
  304. {
  305. manager = m_LocalGenerators[i]->GetMakefile()->GetCacheManager();
  306. m_LocalGenerators[i]->ConfigureFinalPass();
  307. cmTargets const& targets = m_LocalGenerators[i]->GetMakefile()->GetTargets();
  308. for (cmTargets::const_iterator l = targets.begin();
  309. l != targets.end(); l++)
  310. {
  311. cmTarget::LinkLibraries libs = l->second.GetLinkLibraries();
  312. for(cmTarget::LinkLibraries::iterator lib = libs.begin();
  313. lib != libs.end(); ++lib)
  314. {
  315. if(lib->first.size() > 9 &&
  316. cmSystemTools::IsNOTFOUND(lib->first.c_str()))
  317. {
  318. std::string varName = lib->first.substr(0, lib->first.size()-9);
  319. notFoundMap.insert(varName);
  320. }
  321. }
  322. std::vector<std::string>& incs =
  323. m_LocalGenerators[i]->GetMakefile()->GetIncludeDirectories();
  324. for( std::vector<std::string>::iterator lib = incs.begin();
  325. lib != incs.end(); ++lib)
  326. {
  327. if(lib->size() > 9 &&
  328. cmSystemTools::IsNOTFOUND(lib->c_str()))
  329. {
  330. std::string varName = lib->substr(0, lib->size()-9);
  331. notFoundMap.insert(varName);
  332. }
  333. }
  334. m_CMakeInstance->UpdateProgress("Configuring",
  335. 0.9f+0.1f*(i+1.0f)/m_LocalGenerators.size());
  336. m_LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops();
  337. }
  338. }
  339. if(notFoundMap.size())
  340. {
  341. std::string notFoundVars;
  342. for(std::set<std::string>::iterator ii = notFoundMap.begin();
  343. ii != notFoundMap.end(); ++ii)
  344. {
  345. notFoundVars += *ii;
  346. if(manager)
  347. {
  348. cmCacheManager::CacheIterator it =
  349. manager->GetCacheIterator(ii->c_str());
  350. if(it.GetPropertyAsBool("ADVANCED"))
  351. {
  352. notFoundVars += " (ADVANCED)";
  353. }
  354. }
  355. notFoundVars += "\n";
  356. }
  357. cmSystemTools::Error("This project requires some variables to be set,\n"
  358. "and cmake can not find them.\n"
  359. "Please set the following variables:\n",
  360. notFoundVars.c_str());
  361. }
  362. if ( !m_CMakeInstance->GetScriptMode() )
  363. {
  364. m_CMakeInstance->UpdateProgress("Configuring done", -1);
  365. }
  366. }
  367. // loop through the directories creating cmLocalGenerators and Configure()
  368. void cmGlobalGenerator::RecursiveConfigure(cmLocalGenerator *lg,
  369. float startProgress,
  370. float endProgress)
  371. {
  372. // configure the current directory
  373. lg->Configure();
  374. // get all the subdirectories
  375. std::vector<std::pair<cmStdString, bool> > subdirs = lg->GetMakefile()->GetSubDirectories();
  376. float progressPiece = (endProgress - startProgress)/(1.0f+subdirs.size());
  377. m_CMakeInstance->UpdateProgress("Configuring",
  378. startProgress + progressPiece);
  379. // for each subdir recurse
  380. unsigned int i;
  381. for (i = 0; i < subdirs.size(); ++i)
  382. {
  383. cmLocalGenerator *lg2 = this->CreateLocalGenerator();
  384. lg2->SetParent(lg);
  385. m_LocalGenerators.push_back(lg2);
  386. // add the subdir to the start output directory
  387. std::string outdir = lg->GetMakefile()->GetStartOutputDirectory();
  388. outdir += "/";
  389. outdir += subdirs[i].first;
  390. lg2->GetMakefile()->SetStartOutputDirectory(outdir.c_str());
  391. lg2->SetExcludeAll(!subdirs[i].second);
  392. // add the subdir to the start source directory
  393. std::string currentDir = lg->GetMakefile()->GetStartDirectory();
  394. currentDir += "/";
  395. currentDir += subdirs[i].first;
  396. lg2->GetMakefile()->SetStartDirectory(currentDir.c_str());
  397. lg2->GetMakefile()->MakeStartDirectoriesCurrent();
  398. this->RecursiveConfigure(lg2,
  399. startProgress + (i+1.0f)*progressPiece,
  400. startProgress + (i+2.0f)*progressPiece);
  401. }
  402. }
  403. void cmGlobalGenerator::Generate()
  404. {
  405. // For each existing cmLocalGenerator
  406. unsigned int i;
  407. for (i = 0; i < m_LocalGenerators.size(); ++i)
  408. {
  409. m_LocalGenerators[i]->Generate(true);
  410. m_LocalGenerators[i]->GenerateInstallRules();
  411. m_CMakeInstance->UpdateProgress("Generating",
  412. (i+1.0f)/m_LocalGenerators.size());
  413. }
  414. m_CMakeInstance->UpdateProgress("Generating done", -1);
  415. }
  416. void cmGlobalGenerator::LocalGenerate()
  417. {
  418. // for this case we create one LocalGenerator
  419. // configure it, and then Generate it
  420. // start with this directory
  421. cmLocalGenerator *lg = this->CreateLocalGenerator();
  422. // set the Start directories
  423. lg->GetMakefile()->SetStartDirectory(m_CMakeInstance->GetStartDirectory());
  424. lg->GetMakefile()->SetStartOutputDirectory(m_CMakeInstance->GetStartOutputDirectory());
  425. lg->GetMakefile()->MakeStartDirectoriesCurrent();
  426. // now do trhe configure
  427. lg->Configure();
  428. lg->ConfigureFinalPass();
  429. lg->Generate(false);
  430. delete lg;
  431. }
  432. int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
  433. const char *, const char *target,
  434. std::string *output, cmMakefile*)
  435. {
  436. // now build the test
  437. std::string makeCommand =
  438. m_CMakeInstance->GetCacheManager()->GetCacheValue("CMAKE_MAKE_PROGRAM");
  439. if(makeCommand.size() == 0)
  440. {
  441. cmSystemTools::Error(
  442. "Generator cannot find the appropriate make command.");
  443. return 1;
  444. }
  445. makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
  446. /**
  447. * Run an executable command and put the stdout in output.
  448. */
  449. std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
  450. cmSystemTools::ChangeDirectory(bindir);
  451. // Since we have full control over the invocation of nmake, let us
  452. // make it quiet.
  453. if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
  454. {
  455. makeCommand += " /NOLOGO ";
  456. }
  457. // now build
  458. if (target)
  459. {
  460. makeCommand += " ";
  461. makeCommand += target;
  462. #if defined(_WIN32) || defined(__CYGWIN__)
  463. std::string tmp = target;
  464. // if the target does not already end in . something
  465. // then assume .exe
  466. if(tmp.size() < 4 || tmp[tmp.size()-4] != '.')
  467. {
  468. makeCommand += ".exe";
  469. }
  470. #endif // WIN32
  471. }
  472. else
  473. {
  474. makeCommand += " all";
  475. }
  476. int retVal;
  477. int timeout = cmGlobalGenerator::s_TryCompileTimeout;
  478. bool hideconsole = cmSystemTools::GetRunCommandHideConsole();
  479. cmSystemTools::SetRunCommandHideConsole(true);
  480. if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output,
  481. &retVal, 0, false, timeout))
  482. {
  483. cmSystemTools::SetRunCommandHideConsole(hideconsole);
  484. cmSystemTools::Error("Generator: execution of make failed.");
  485. // return to the original directory
  486. cmSystemTools::ChangeDirectory(cwd.c_str());
  487. return 1;
  488. }
  489. cmSystemTools::SetRunCommandHideConsole(hideconsole);
  490. // The SGI MipsPro 7.3 compiler does not return an error code when
  491. // the source has a #error in it! This is a work-around for such
  492. // compilers.
  493. if((retVal == 0) && (output->find("#error") != std::string::npos))
  494. {
  495. retVal = 1;
  496. }
  497. cmSystemTools::ChangeDirectory(cwd.c_str());
  498. return retVal;
  499. }
  500. cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
  501. {
  502. cmLocalGenerator *lg = new cmLocalGenerator;
  503. lg->SetGlobalGenerator(this);
  504. return lg;
  505. }
  506. void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator *gen )
  507. {
  508. this->SetConfiguredFilesPath(
  509. gen->GetCMakeInstance()->GetHomeOutputDirectory());
  510. const char* make =
  511. gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
  512. this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make,
  513. "make program",
  514. cmCacheManager::FILEPATH);
  515. for(std::map<cmStdString, bool>::iterator i = gen->m_LanguageEnabled.begin();
  516. i != gen->m_LanguageEnabled.end(); ++i)
  517. {
  518. this->SetLanguageEnabled(i->first.c_str());
  519. }
  520. }
  521. //----------------------------------------------------------------------------
  522. void cmGlobalGenerator::GetDocumentation(cmDocumentationEntry& entry) const
  523. {
  524. entry.name = this->GetName();
  525. entry.brief = "";
  526. entry.full = "";
  527. }
  528. bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
  529. cmLocalGenerator* gen)
  530. {
  531. cmLocalGenerator* cur = gen->GetParent();
  532. while(cur && cur != root)
  533. {
  534. if(cur->GetExcludeAll())
  535. {
  536. return true;
  537. }
  538. cur = cur->GetParent();
  539. }
  540. return false;
  541. }