cmGlobalVisualStudio10Generator.cxx 20 KB

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