cmGlobalVisualStudio10Generator.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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. {
  286. return new cmLocalVisualStudio10Generator(this, parent);
  287. }
  288. //----------------------------------------------------------------------------
  289. void cmGlobalVisualStudio10Generator::Generate()
  290. {
  291. this->LongestSource = LongestSourcePath();
  292. this->cmGlobalVisualStudio8Generator::Generate();
  293. if(this->LongestSource.Length > 0)
  294. {
  295. cmMakefile* mf = this->LongestSource.Target->GetMakefile();
  296. std::ostringstream e;
  297. e <<
  298. "The binary and/or source directory paths may be too long to generate "
  299. "Visual Studio 10 files for this project. "
  300. "Consider choosing shorter directory names to build this project with "
  301. "Visual Studio 10. "
  302. "A more detailed explanation follows."
  303. "\n"
  304. "There is a bug in the VS 10 IDE that renders property dialog fields "
  305. "blank for files referenced by full path in the project file. "
  306. "However, CMake must reference at least one file by full path:\n"
  307. " " << this->LongestSource.SourceFile->GetFullPath() << "\n"
  308. "This is because some Visual Studio tools would append the relative "
  309. "path to the end of the referencing directory path, as in:\n"
  310. " " << mf->GetCurrentBinaryDirectory() << "/"
  311. << this->LongestSource.SourceRel << "\n"
  312. "and then incorrectly complain that the file does not exist because "
  313. "the path length is too long for some internal buffer or API. "
  314. "To avoid this problem CMake must use a full path for this file "
  315. "which then triggers the VS 10 property dialog bug.";
  316. mf->IssueMessage(cmake::WARNING, e.str().c_str());
  317. }
  318. }
  319. //----------------------------------------------------------------------------
  320. void cmGlobalVisualStudio10Generator
  321. ::EnableLanguage(std::vector<std::string>const & lang,
  322. cmMakefile *mf, bool optional)
  323. {
  324. cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
  325. }
  326. //----------------------------------------------------------------------------
  327. const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() const
  328. {
  329. if(!this->GeneratorToolset.empty())
  330. {
  331. return this->GeneratorToolset.c_str();
  332. }
  333. if(!this->DefaultPlatformToolset.empty())
  334. {
  335. return this->DefaultPlatformToolset.c_str();
  336. }
  337. return 0;
  338. }
  339. //----------------------------------------------------------------------------
  340. void cmGlobalVisualStudio10Generator::FindMakeProgram(cmMakefile* mf)
  341. {
  342. this->cmGlobalVisualStudio8Generator::FindMakeProgram(mf);
  343. mf->AddDefinition("CMAKE_VS_MSBUILD_COMMAND",
  344. this->GetMSBuildCommand().c_str());
  345. }
  346. //----------------------------------------------------------------------------
  347. std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand()
  348. {
  349. if(!this->MSBuildCommandInitialized)
  350. {
  351. this->MSBuildCommandInitialized = true;
  352. this->MSBuildCommand = this->FindMSBuildCommand();
  353. }
  354. return this->MSBuildCommand;
  355. }
  356. //----------------------------------------------------------------------------
  357. std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand()
  358. {
  359. std::string msbuild;
  360. std::string mskey =
  361. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\";
  362. mskey += this->GetToolsVersion();
  363. mskey += ";MSBuildToolsPath";
  364. if(cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild,
  365. cmSystemTools::KeyWOW64_32))
  366. {
  367. cmSystemTools::ConvertToUnixSlashes(msbuild);
  368. msbuild += "/";
  369. }
  370. msbuild += "MSBuild.exe";
  371. return msbuild;
  372. }
  373. //----------------------------------------------------------------------------
  374. std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand()
  375. {
  376. if(this->ExpressEdition)
  377. {
  378. // Visual Studio Express >= 10 do not have "devenv.com" or
  379. // "VCExpress.exe" that we can use to build reliably.
  380. // Tell the caller it needs to use MSBuild instead.
  381. return "";
  382. }
  383. // Skip over the cmGlobalVisualStudio8Generator implementation because
  384. // we expect a real devenv and do not want to look for VCExpress.
  385. return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand();
  386. }
  387. //----------------------------------------------------------------------------
  388. void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
  389. std::vector<std::string>& makeCommand,
  390. const std::string& makeProgram,
  391. const std::string& projectName,
  392. const std::string& projectDir,
  393. const std::string& targetName,
  394. const std::string& config,
  395. bool fast, bool verbose,
  396. std::vector<std::string> const& makeOptions)
  397. {
  398. // Select the caller- or user-preferred make program, else MSBuild.
  399. std::string makeProgramSelected =
  400. this->SelectMakeProgram(makeProgram, this->GetMSBuildCommand());
  401. // Check if the caller explicitly requested a devenv tool.
  402. std::string makeProgramLower = makeProgramSelected;
  403. cmSystemTools::LowerCase(makeProgramLower);
  404. bool useDevEnv =
  405. (makeProgramLower.find("devenv") != std::string::npos ||
  406. makeProgramLower.find("vcexpress") != std::string::npos);
  407. // MSBuild is preferred (and required for VS Express), but if the .sln has
  408. // an Intel Fortran .vfproj then we have to use devenv. Parse it to find out.
  409. cmSlnData slnData;
  410. {
  411. std::string slnFile;
  412. if(!projectDir.empty())
  413. {
  414. slnFile = projectDir;
  415. slnFile += "/";
  416. }
  417. slnFile += projectName;
  418. slnFile += ".sln";
  419. cmVisualStudioSlnParser parser;
  420. if(parser.ParseFile(slnFile, slnData,
  421. cmVisualStudioSlnParser::DataGroupProjects))
  422. {
  423. std::vector<cmSlnProjectEntry> slnProjects = slnData.GetProjects();
  424. for(std::vector<cmSlnProjectEntry>::iterator i = slnProjects.begin();
  425. !useDevEnv && i != slnProjects.end(); ++i)
  426. {
  427. std::string proj = i->GetRelativePath();
  428. if(proj.size() > 7 &&
  429. proj.substr(proj.size()-7) == ".vfproj")
  430. {
  431. useDevEnv = true;
  432. }
  433. }
  434. }
  435. }
  436. if(useDevEnv)
  437. {
  438. // Use devenv to build solutions containing Intel Fortran projects.
  439. cmGlobalVisualStudio7Generator::GenerateBuildCommand(
  440. makeCommand, makeProgram, projectName, projectDir,
  441. targetName, config, fast, verbose, makeOptions);
  442. return;
  443. }
  444. makeCommand.push_back(makeProgramSelected);
  445. std::string realTarget = targetName;
  446. // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD
  447. if(realTarget.empty())
  448. {
  449. realTarget = "ALL_BUILD";
  450. }
  451. if ( realTarget == "clean" )
  452. {
  453. makeCommand.push_back(std::string(projectName)+".sln");
  454. makeCommand.push_back("/t:Clean");
  455. }
  456. else
  457. {
  458. std::string targetProject(realTarget);
  459. targetProject += ".vcxproj";
  460. if (targetProject.find('/') == std::string::npos)
  461. {
  462. // it might be in a subdir
  463. if (cmSlnProjectEntry const* proj =
  464. slnData.GetProjectByName(realTarget))
  465. {
  466. targetProject = proj->GetRelativePath();
  467. cmSystemTools::ConvertToUnixSlashes(targetProject);
  468. }
  469. }
  470. makeCommand.push_back(targetProject);
  471. }
  472. std::string configArg = "/p:Configuration=";
  473. if(!config.empty())
  474. {
  475. configArg += config;
  476. }
  477. else
  478. {
  479. configArg += "Debug";
  480. }
  481. makeCommand.push_back(configArg);
  482. makeCommand.push_back(std::string("/p:VisualStudioVersion=")+
  483. this->GetIDEVersion());
  484. makeCommand.insert(makeCommand.end(),
  485. makeOptions.begin(), makeOptions.end());
  486. }
  487. //----------------------------------------------------------------------------
  488. bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf)
  489. {
  490. if(this->GetPlatformToolset())
  491. {
  492. return true;
  493. }
  494. // This edition does not come with 64-bit tools. Look for them.
  495. //
  496. // TODO: Detect available tools? x64\v100 exists but does not work?
  497. // HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
  498. // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
  499. // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
  500. std::string winSDK_7_1;
  501. if(cmSystemTools::ReadRegistryValue(
  502. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
  503. "Windows\\v7.1;InstallationFolder", winSDK_7_1))
  504. {
  505. std::ostringstream m;
  506. m << "Found Windows SDK v7.1: " << winSDK_7_1;
  507. mf->DisplayStatus(m.str().c_str(), -1);
  508. this->DefaultPlatformToolset = "Windows7.1SDK";
  509. return true;
  510. }
  511. else
  512. {
  513. std::ostringstream e;
  514. e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
  515. << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
  516. << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
  517. mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
  518. cmSystemTools::SetFatalErrorOccured();
  519. return false;
  520. }
  521. }
  522. //----------------------------------------------------------------------------
  523. std::string
  524. cmGlobalVisualStudio10Generator
  525. ::GenerateRuleFile(std::string const& output) const
  526. {
  527. // The VS 10 generator needs to create the .rule files on disk.
  528. // Hide them away under the CMakeFiles directory.
  529. std::string ruleDir = this->GetCMakeInstance()->GetHomeOutputDirectory();
  530. ruleDir += cmake::GetCMakeFilesDirectory();
  531. ruleDir += "/";
  532. ruleDir += cmSystemTools::ComputeStringMD5(
  533. cmSystemTools::GetFilenamePath(output).c_str());
  534. std::string ruleFile = ruleDir + "/";
  535. ruleFile += cmSystemTools::GetFilenameName(output);
  536. ruleFile += ".rule";
  537. return ruleFile;
  538. }
  539. //----------------------------------------------------------------------------
  540. void cmGlobalVisualStudio10Generator::PathTooLong(
  541. cmTarget* target, cmSourceFile const* sf, std::string const& sfRel)
  542. {
  543. size_t len = (strlen(target->GetMakefile()->GetCurrentBinaryDirectory()) +
  544. 1 + sfRel.length());
  545. if(len > this->LongestSource.Length)
  546. {
  547. this->LongestSource.Length = len;
  548. this->LongestSource.Target = target;
  549. this->LongestSource.SourceFile = sf;
  550. this->LongestSource.SourceRel = sfRel;
  551. }
  552. }
  553. //----------------------------------------------------------------------------
  554. bool cmGlobalVisualStudio10Generator::UseFolderProperty()
  555. {
  556. return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty();
  557. }
  558. //----------------------------------------------------------------------------
  559. bool cmGlobalVisualStudio10Generator::IsNsightTegra() const
  560. {
  561. return !this->NsightTegraVersion.empty();
  562. }
  563. //----------------------------------------------------------------------------
  564. std::string cmGlobalVisualStudio10Generator::GetNsightTegraVersion() const
  565. {
  566. return this->NsightTegraVersion;
  567. }
  568. //----------------------------------------------------------------------------
  569. std::string cmGlobalVisualStudio10Generator::GetInstalledNsightTegraVersion()
  570. {
  571. std::string version;
  572. cmSystemTools::ReadRegistryValue(
  573. "HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Nsight Tegra;"
  574. "Version", version, cmSystemTools::KeyWOW64_32);
  575. return version;
  576. }