cmGlobalVisualStudio10Generator.cxx 18 KB

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