cmGlobalVisualStudio10Generator.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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 "windows.h" // this must be first to define GetCurrentDirectory
  11. #include "cmGlobalVisualStudio10Generator.h"
  12. #include "cmLocalVisualStudio10Generator.h"
  13. #include "cmMakefile.h"
  14. #include "cmSourceFile.h"
  15. #include "cmVisualStudioSlnData.h"
  16. #include "cmVisualStudioSlnParser.h"
  17. #include "cmake.h"
  18. #include "cmAlgorithms.h"
  19. static const char vs10generatorName[] = "Visual Studio 10 2010";
  20. // Map generator name without year to name with year.
  21. static const char* cmVS10GenName(const std::string& name, std::string& genName)
  22. {
  23. if(strncmp(name.c_str(), vs10generatorName,
  24. sizeof(vs10generatorName)-6) != 0)
  25. {
  26. return 0;
  27. }
  28. const char* p = name.c_str() + sizeof(vs10generatorName) - 6;
  29. if(cmHasLiteralPrefix(p, " 2010"))
  30. {
  31. p += 5;
  32. }
  33. genName = std::string(vs10generatorName) + p;
  34. return p;
  35. }
  36. class cmGlobalVisualStudio10Generator::Factory
  37. : public cmGlobalGeneratorFactory
  38. {
  39. public:
  40. virtual cmGlobalGenerator*
  41. CreateGlobalGenerator(const std::string& name, cmake* cm) const
  42. {
  43. std::string genName;
  44. const char* p = cmVS10GenName(name, genName);
  45. if(!p)
  46. { return 0; }
  47. if(!*p)
  48. {
  49. return new cmGlobalVisualStudio10Generator(cm, genName, "");
  50. }
  51. if(*p++ != ' ')
  52. { return 0; }
  53. if(strcmp(p, "Win64") == 0)
  54. {
  55. return new cmGlobalVisualStudio10Generator(cm, genName, "x64");
  56. }
  57. if(strcmp(p, "IA64") == 0)
  58. {
  59. return new cmGlobalVisualStudio10Generator(cm, genName, "Itanium");
  60. }
  61. return 0;
  62. }
  63. virtual void GetDocumentation(cmDocumentationEntry& entry) const
  64. {
  65. entry.Name = std::string(vs10generatorName) + " [arch]";
  66. entry.Brief =
  67. "Generates Visual Studio 2010 project files. "
  68. "Optional [arch] can be \"Win64\" or \"IA64\"."
  69. ;
  70. }
  71. virtual void GetGenerators(std::vector<std::string>& names) const
  72. {
  73. names.push_back(vs10generatorName);
  74. names.push_back(vs10generatorName + std::string(" IA64"));
  75. names.push_back(vs10generatorName + std::string(" Win64"));
  76. }
  77. };
  78. //----------------------------------------------------------------------------
  79. cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
  80. {
  81. return new Factory;
  82. }
  83. //----------------------------------------------------------------------------
  84. cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(cmake* cm,
  85. const std::string& name, const std::string& platformName)
  86. : cmGlobalVisualStudio8Generator(cm, name, platformName)
  87. {
  88. std::string vc10Express;
  89. this->ExpressEdition = cmSystemTools::ReadRegistryValue(
  90. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
  91. "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
  92. this->SystemIsWindowsCE = false;
  93. this->SystemIsWindowsPhone = false;
  94. this->SystemIsWindowsStore = false;
  95. this->MSBuildCommandInitialized = false;
  96. this->Version = VS10;
  97. }
  98. //----------------------------------------------------------------------------
  99. bool
  100. cmGlobalVisualStudio10Generator::MatchesGeneratorName(
  101. const std::string& name) const
  102. {
  103. std::string genName;
  104. if(cmVS10GenName(name, genName))
  105. {
  106. return genName == this->GetName();
  107. }
  108. return false;
  109. }
  110. //----------------------------------------------------------------------------
  111. bool cmGlobalVisualStudio10Generator::SetSystemName(std::string const& s,
  112. cmMakefile* mf)
  113. {
  114. this->SystemName = s;
  115. this->SystemVersion = mf->GetSafeDefinition("CMAKE_SYSTEM_VERSION");
  116. if(!this->InitializeSystem(mf))
  117. {
  118. return false;
  119. }
  120. return this->cmGlobalVisualStudio8Generator::SetSystemName(s, mf);
  121. }
  122. //----------------------------------------------------------------------------
  123. bool
  124. cmGlobalVisualStudio10Generator::SetGeneratorPlatform(std::string const& p,
  125. cmMakefile* mf)
  126. {
  127. if(!this->cmGlobalVisualStudio8Generator::SetGeneratorPlatform(p, mf))
  128. {
  129. return false;
  130. }
  131. if(this->GetPlatformName() == "Itanium" || this->GetPlatformName() == "x64")
  132. {
  133. if(this->IsExpressEdition() && !this->Find64BitTools(mf))
  134. {
  135. return false;
  136. }
  137. }
  138. return true;
  139. }
  140. //----------------------------------------------------------------------------
  141. bool
  142. cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts,
  143. cmMakefile* mf)
  144. {
  145. if (this->SystemIsWindowsCE && ts.empty() &&
  146. this->DefaultPlatformToolset.empty())
  147. {
  148. std::ostringstream e;
  149. e << this->GetName() << " Windows CE version '" << this->SystemVersion
  150. << "' requires CMAKE_GENERATOR_TOOLSET to be set.";
  151. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  152. return false;
  153. }
  154. this->GeneratorToolset = ts;
  155. if(const char* toolset = this->GetPlatformToolset())
  156. {
  157. mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", toolset);
  158. }
  159. return true;
  160. }
  161. //----------------------------------------------------------------------------
  162. bool cmGlobalVisualStudio10Generator::InitializeSystem(cmMakefile* mf)
  163. {
  164. if (this->SystemName == "WindowsCE")
  165. {
  166. this->SystemIsWindowsCE = true;
  167. if (!this->InitializeWindowsCE(mf))
  168. {
  169. return false;
  170. }
  171. }
  172. else if(this->SystemName == "WindowsPhone")
  173. {
  174. this->SystemIsWindowsPhone = true;
  175. if(!this->InitializeWindowsPhone(mf))
  176. {
  177. return false;
  178. }
  179. }
  180. else if(this->SystemName == "WindowsStore")
  181. {
  182. this->SystemIsWindowsStore = true;
  183. if(!this->InitializeWindowsStore(mf))
  184. {
  185. return false;
  186. }
  187. }
  188. else if(this->SystemName == "Android")
  189. {
  190. if(this->DefaultPlatformName != "Win32")
  191. {
  192. std::ostringstream e;
  193. e << "CMAKE_SYSTEM_NAME is 'Android' but CMAKE_GENERATOR "
  194. << "specifies a platform too: '" << this->GetName() << "'";
  195. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  196. return false;
  197. }
  198. std::string v = this->GetInstalledNsightTegraVersion();
  199. if(v.empty())
  200. {
  201. mf->IssueMessage(cmake::FATAL_ERROR,
  202. "CMAKE_SYSTEM_NAME is 'Android' but "
  203. "'NVIDIA Nsight Tegra Visual Studio Edition' "
  204. "is not installed.");
  205. return false;
  206. }
  207. this->DefaultPlatformName = "Tegra-Android";
  208. this->DefaultPlatformToolset = "Default";
  209. this->NsightTegraVersion = v;
  210. mf->AddDefinition("CMAKE_VS_NsightTegra_VERSION", v.c_str());
  211. }
  212. return true;
  213. }
  214. //----------------------------------------------------------------------------
  215. bool cmGlobalVisualStudio10Generator::InitializeWindowsCE(cmMakefile* mf)
  216. {
  217. if (this->DefaultPlatformName != "Win32")
  218. {
  219. std::ostringstream e;
  220. e << "CMAKE_SYSTEM_NAME is 'WindowsCE' but CMAKE_GENERATOR "
  221. << "specifies a platform too: '" << this->GetName() << "'";
  222. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  223. return false;
  224. }
  225. this->DefaultPlatformToolset = this->SelectWindowsCEToolset();
  226. return true;
  227. }
  228. //----------------------------------------------------------------------------
  229. bool cmGlobalVisualStudio10Generator::InitializeWindowsPhone(cmMakefile* mf)
  230. {
  231. std::ostringstream e;
  232. e << this->GetName() << " does not support Windows Phone.";
  233. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  234. return false;
  235. }
  236. //----------------------------------------------------------------------------
  237. bool cmGlobalVisualStudio10Generator::InitializeWindowsStore(cmMakefile* mf)
  238. {
  239. std::ostringstream e;
  240. e << this->GetName() << " does not support Windows Store.";
  241. mf->IssueMessage(cmake::FATAL_ERROR, e.str());
  242. return false;
  243. }
  244. //----------------------------------------------------------------------------
  245. bool
  246. cmGlobalVisualStudio10Generator::SelectWindowsPhoneToolset(
  247. std::string& toolset) const
  248. {
  249. toolset = "";
  250. return false;
  251. }
  252. //----------------------------------------------------------------------------
  253. bool
  254. cmGlobalVisualStudio10Generator::SelectWindowsStoreToolset(
  255. std::string& toolset) const
  256. {
  257. toolset = "";
  258. return false;
  259. }
  260. //----------------------------------------------------------------------------
  261. std::string cmGlobalVisualStudio10Generator::SelectWindowsCEToolset() const
  262. {
  263. if (this->SystemVersion == "8.0")
  264. {
  265. return "CE800";
  266. }
  267. return "";
  268. }
  269. //----------------------------------------------------------------------------
  270. void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
  271. {
  272. fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n";
  273. if (this->ExpressEdition)
  274. {
  275. fout << "# Visual C++ Express 2010\n";
  276. }
  277. else
  278. {
  279. fout << "# Visual Studio 2010\n";
  280. }
  281. }
  282. ///! Create a local generator appropriate to this Global Generator
  283. cmLocalGenerator *
  284. cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent,
  285. cmState::Snapshot snapshot)
  286. {
  287. return new cmLocalVisualStudio10Generator(this, parent, snapshot);
  288. }
  289. //----------------------------------------------------------------------------
  290. bool cmGlobalVisualStudio10Generator::Compute()
  291. {
  292. if (!cmGlobalVisualStudio8Generator::Compute())
  293. {
  294. return false;
  295. }
  296. this->LongestSource = LongestSourcePath();
  297. return true;
  298. }
  299. void cmGlobalVisualStudio10Generator::Generate()
  300. {
  301. this->cmGlobalVisualStudio8Generator::Generate();
  302. if(this->LongestSource.Length > 0)
  303. {
  304. cmMakefile* mf = this->LongestSource.Target->GetMakefile();
  305. std::ostringstream e;
  306. e <<
  307. "The binary and/or source directory paths may be too long to generate "
  308. "Visual Studio 10 files for this project. "
  309. "Consider choosing shorter directory names to build this project with "
  310. "Visual Studio 10. "
  311. "A more detailed explanation follows."
  312. "\n"
  313. "There is a bug in the VS 10 IDE that renders property dialog fields "
  314. "blank for files referenced by full path in the project file. "
  315. "However, CMake must reference at least one file by full path:\n"
  316. " " << this->LongestSource.SourceFile->GetFullPath() << "\n"
  317. "This is because some Visual Studio tools would append the relative "
  318. "path to the end of the referencing directory path, as in:\n"
  319. " " << mf->GetCurrentBinaryDirectory() << "/"
  320. << this->LongestSource.SourceRel << "\n"
  321. "and then incorrectly complain that the file does not exist because "
  322. "the path length is too long for some internal buffer or API. "
  323. "To avoid this problem CMake must use a full path for this file "
  324. "which then triggers the VS 10 property dialog bug.";
  325. mf->IssueMessage(cmake::WARNING, e.str().c_str());
  326. }
  327. }
  328. //----------------------------------------------------------------------------
  329. void cmGlobalVisualStudio10Generator
  330. ::EnableLanguage(std::vector<std::string>const & lang,
  331. cmMakefile *mf, bool optional)
  332. {
  333. cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
  334. }
  335. //----------------------------------------------------------------------------
  336. const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
  337. {
  338. if(!this->GeneratorToolset.empty())
  339. {
  340. return this->GeneratorToolset.c_str();
  341. }
  342. if(!this->DefaultPlatformToolset.empty())
  343. {
  344. return this->DefaultPlatformToolset.c_str();
  345. }
  346. return 0;
  347. }
  348. //----------------------------------------------------------------------------
  349. void cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
  350. {
  351. this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf);
  352. mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND",
  353. this->GetMSBuildCommand().c_str());
  354. }
  355. //----------------------------------------------------------------------------
  356. std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand()
  357. {
  358. if(!this->MSBuildCommandInitialized)
  359. {
  360. this->MSBuildCommandInitialized = true;
  361. this->MSBuildCommand = this->FindMSBuildCommand();
  362. }
  363. return this->MSBuildCommand;
  364. }
  365. //----------------------------------------------------------------------------
  366. std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand()
  367. {
  368. std::string msbuild;
  369. std::string mskey =
  370. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\";
  371. mskey += this->GetToolsVersion();
  372. mskey += ";MSBuildToolsPath";
  373. if(cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild,
  374. cmSystemTools::KeyWOW64_32))
  375. {
  376. cmSystemTools::ConvertToUnixSlashes(msbuild);
  377. msbuild += "/";
  378. }
  379. msbuild += "MSBuild.exe";
  380. return msbuild;
  381. }
  382. //----------------------------------------------------------------------------
  383. std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand()
  384. {
  385. if(this->ExpressEdition)
  386. {
  387. // Visual Studio Express >= 10 do not have "devenv.com" or
  388. // "VCExpress.exe" that we can use to build reliably.
  389. // Tell the caller it needs to use MSBuild instead.
  390. return "";
  391. }
  392. // Skip over the cmGlobalVisualStudio8Generator implementation because
  393. // we expect a real devenv and do not want to look for VCExpress.
  394. return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand();
  395. }
  396. //----------------------------------------------------------------------------
  397. void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
  398. std::vector<std::string>& makeCommand,
  399. const std::string& makeProgram,
  400. const std::string& projectName,
  401. const std::string& projectDir,
  402. const std::string& targetName,
  403. const std::string& config,
  404. bool fast, bool verbose,
  405. std::vector<std::string> const& makeOptions)
  406. {
  407. // Select the caller- or user-preferred make program, else MSBuild.
  408. std::string makeProgramSelected =
  409. this->SelectMakeProgram(makeProgram, this->GetMSBuildCommand());
  410. // Check if the caller explicitly requested a devenv tool.
  411. std::string makeProgramLower = makeProgramSelected;
  412. cmSystemTools::LowerCase(makeProgramLower);
  413. bool useDevEnv =
  414. (makeProgramLower.find("devenv") != std::string::npos ||
  415. makeProgramLower.find("vcexpress") != std::string::npos);
  416. // MSBuild is preferred (and required for VS Express), but if the .sln has
  417. // an Intel Fortran .vfproj then we have to use devenv. Parse it to find out.
  418. cmSlnData slnData;
  419. {
  420. std::string slnFile;
  421. if(!projectDir.empty())
  422. {
  423. slnFile = projectDir;
  424. slnFile += "/";
  425. }
  426. slnFile += projectName;
  427. slnFile += ".sln";
  428. cmVisualStudioSlnParser parser;
  429. if(parser.ParseFile(slnFile, slnData,
  430. cmVisualStudioSlnParser::DataGroupProjects))
  431. {
  432. std::vector<cmSlnProjectEntry> slnProjects = slnData.GetProjects();
  433. for(std::vector<cmSlnProjectEntry>::iterator i = slnProjects.begin();
  434. !useDevEnv && i != slnProjects.end(); ++i)
  435. {
  436. std::string proj = i->GetRelativePath();
  437. if(proj.size() > 7 &&
  438. proj.substr(proj.size()-7) == ".vfproj")
  439. {
  440. useDevEnv = true;
  441. }
  442. }
  443. }
  444. }
  445. if(useDevEnv)
  446. {
  447. // Use devenv to build solutions containing Intel Fortran projects.
  448. cmGlobalVisualStudio7Generator::GenerateBuildCommand(
  449. makeCommand, makeProgram, projectName, projectDir,
  450. targetName, config, fast, verbose, makeOptions);
  451. return;
  452. }
  453. makeCommand.push_back(makeProgramSelected);
  454. std::string realTarget = targetName;
  455. // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD
  456. if(realTarget.empty())
  457. {
  458. realTarget = "ALL_BUILD";
  459. }
  460. if ( realTarget == "clean" )
  461. {
  462. makeCommand.push_back(std::string(projectName)+".sln");
  463. makeCommand.push_back("/t:Clean");
  464. }
  465. else
  466. {
  467. std::string targetProject(realTarget);
  468. targetProject += ".vcxproj";
  469. if (targetProject.find('/') == std::string::npos)
  470. {
  471. // it might be in a subdir
  472. if (cmSlnProjectEntry const* proj =
  473. slnData.GetProjectByName(realTarget))
  474. {
  475. targetProject = proj->GetRelativePath();
  476. cmSystemTools::ConvertToUnixSlashes(targetProject);
  477. }
  478. }
  479. makeCommand.push_back(targetProject);
  480. }
  481. std::string configArg = "/p:Configuration=";
  482. if(!config.empty())
  483. {
  484. configArg += config;
  485. }
  486. else
  487. {
  488. configArg += "Debug";
  489. }
  490. makeCommand.push_back(configArg);
  491. makeCommand.push_back(std::string("/p:VisualStudioVersion=")+
  492. this->GetIDEVersion());
  493. makeCommand.insert(makeCommand.end(),
  494. makeOptions.begin(), makeOptions.end());
  495. }
  496. //----------------------------------------------------------------------------
  497. bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
  498. {
  499. if(this->GetPlatformToolset())
  500. {
  501. return true;
  502. }
  503. // This edition does not come with 64-bit tools. Look for them.
  504. //
  505. // TODO: Detect available tools? x64\v100 exists but does not work?
  506. // HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
  507. // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
  508. // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
  509. std::string winSDK_7_1;
  510. if(cmSystemTools::ReadRegistryValue(
  511. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
  512. "Windows\\v7.1;InstallationFolder", winSDK_7_1))
  513. {
  514. std::ostringstream m;
  515. m << "Found Windows SDK v7.1: " << winSDK_7_1;
  516. mf->DisplayStatus(m.str().c_str(), -1);
  517. this->DefaultPlatformToolset = "Windows7.1SDK";
  518. return true;
  519. }
  520. else
  521. {
  522. std::ostringstream e;
  523. e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
  524. << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
  525. << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
  526. mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
  527. cmSystemTools::SetFatalErrorOccured();
  528. return false;
  529. }
  530. }
  531. //----------------------------------------------------------------------------
  532. std::string
  533. cmGlobalVisualStudio10Generator
  534. ::GenerateRuleFile(std::string const& output) const
  535. {
  536. // The VS 10 generator needs to create the .rule files on disk.
  537. // Hide them away under the CMakeFiles directory.
  538. std::string ruleDir = this->GetCMakeInstance()->GetHomeOutputDirectory();
  539. ruleDir += cmake::GetCMakeFilesDirectory();
  540. ruleDir += "/";
  541. ruleDir += cmSystemTools::ComputeStringMD5(
  542. cmSystemTools::GetFilenamePath(output).c_str());
  543. std::string ruleFile = ruleDir + "/";
  544. ruleFile += cmSystemTools::GetFilenameName(output);
  545. ruleFile += ".rule";
  546. return ruleFile;
  547. }
  548. //----------------------------------------------------------------------------
  549. void cmGlobalVisualStudio10Generator::PathTooLong(
  550. cmTarget* target, cmSourceFile const* sf, std::string const& sfRel)
  551. {
  552. size_t len = (strlen(target->GetMakefile()->GetCurrentBinaryDirectory()) +
  553. 1 + sfRel.length());
  554. if(len > this->LongestSource.Length)
  555. {
  556. this->LongestSource.Length = len;
  557. this->LongestSource.Target = target;
  558. this->LongestSource.SourceFile = sf;
  559. this->LongestSource.SourceRel = sfRel;
  560. }
  561. }
  562. //----------------------------------------------------------------------------
  563. bool cmGlobalVisualStudio10Generator::UseFolderProperty()
  564. {
  565. return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty();
  566. }
  567. //----------------------------------------------------------------------------
  568. bool cmGlobalVisualStudio10Generator::IsNsightTegra() const
  569. {
  570. return !this->NsightTegraVersion.empty();
  571. }
  572. //----------------------------------------------------------------------------
  573. std::string cmGlobalVisualStudio10Generator::GetNsightTegraVersion() const
  574. {
  575. return this->NsightTegraVersion;
  576. }
  577. //----------------------------------------------------------------------------
  578. std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
  579. {
  580. std::string version;
  581. cmSystemTools::ReadRegistryValue(
  582. "HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;"
  583. "Version", version, cmSystemTools::KeyWOW64_32);
  584. return version;
  585. }