cmGlobalVisualStudio10Win64Generator.cxx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 "cmGlobalVisualStudio10Win64Generator.h"
  11. #include "cmMakefile.h"
  12. #include "cmake.h"
  13. //----------------------------------------------------------------------------
  14. cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator()
  15. {
  16. }
  17. //----------------------------------------------------------------------------
  18. void cmGlobalVisualStudio10Win64Generator
  19. ::GetDocumentation(cmDocumentationEntry& entry) const
  20. {
  21. entry.Name = this->GetName();
  22. entry.Brief = "Generates Visual Studio 10 Win64 project files.";
  23. entry.Full = "";
  24. }
  25. //----------------------------------------------------------------------------
  26. void cmGlobalVisualStudio10Win64Generator
  27. ::AddPlatformDefinitions(cmMakefile* mf)
  28. {
  29. this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf);
  30. mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
  31. mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
  32. mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
  33. }
  34. //----------------------------------------------------------------------------
  35. bool cmGlobalVisualStudio10Win64Generator::Find64BitTools(cmMakefile* mf)
  36. {
  37. if(!this->PlatformToolset.empty())
  38. {
  39. return true;
  40. }
  41. // This edition does not come with 64-bit tools. Look for them.
  42. //
  43. // TODO: Detect available tools? x64\v100 exists but does not work?
  44. // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
  45. // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
  46. // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
  47. std::string winSDK_7_1;
  48. if(cmSystemTools::ReadRegistryValue(
  49. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
  50. "Windows\\v7.1;InstallationFolder", winSDK_7_1))
  51. {
  52. cmOStringStream m;
  53. m << "Found Windows SDK v7.1: " << winSDK_7_1;
  54. mf->DisplayStatus(m.str().c_str(), -1);
  55. this->PlatformToolset = "Windows7.1SDK";
  56. return true;
  57. }
  58. else
  59. {
  60. cmOStringStream e;
  61. e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
  62. << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
  63. << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
  64. mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
  65. cmSystemTools::SetFatalErrorOccured();
  66. return false;
  67. }
  68. }
  69. //----------------------------------------------------------------------------
  70. void cmGlobalVisualStudio10Win64Generator
  71. ::EnableLanguage(std::vector<std::string> const& languages,
  72. cmMakefile* mf, bool optional)
  73. {
  74. if(this->IsExpressEdition() && !this->Find64BitTools(mf))
  75. {
  76. return;
  77. }
  78. this->cmGlobalVisualStudio10Generator
  79. ::EnableLanguage(languages, mf, optional);
  80. }