cmGlobalVisualStudio10Generator.cxx 18 KB

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