cmGlobalVisualStudio11Generator.cxx 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2011 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 "cmGlobalVisualStudio11Generator.h"
  11. #include "cmLocalVisualStudio10Generator.h"
  12. #include "cmMakefile.h"
  13. static const char vs11Win32generatorName[] = "Visual Studio 11";
  14. static const char vs11Win64generatorName[] = "Visual Studio 11 Win64";
  15. static const char vs11ARMgeneratorName[] = "Visual Studio 11 ARM";
  16. class cmGlobalVisualStudio11Generator::Factory
  17. : public cmGlobalGeneratorFactory
  18. {
  19. public:
  20. virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
  21. if(!strcmp(name, vs11Win32generatorName))
  22. {
  23. return new cmGlobalVisualStudio11Generator(
  24. vs11Win32generatorName, NULL, NULL);
  25. }
  26. if(!strcmp(name, vs11Win64generatorName))
  27. {
  28. return new cmGlobalVisualStudio11Generator(
  29. vs11Win64generatorName, "x64", "CMAKE_FORCE_WIN64");
  30. }
  31. if(!strcmp(name, vs11ARMgeneratorName))
  32. {
  33. return new cmGlobalVisualStudio11Generator(
  34. vs11ARMgeneratorName, "ARM", NULL);
  35. }
  36. return 0;
  37. }
  38. virtual void GetDocumentation(cmDocumentationEntry& entry) const {
  39. entry.Name = "Visual Studio 11";
  40. entry.Brief = "Generates Visual Studio 11 project files.";
  41. entry.Full =
  42. "It is possible to append a space followed by the platform name "
  43. "to create project files for a specific target platform. E.g. "
  44. "\"Visual Studio 11 Win64\" will create project files for "
  45. "the x64 processor; \"Visual Studio 11 ARM\" for ARM.";
  46. }
  47. virtual void GetGenerators(std::vector<std::string>& names) const {
  48. names.push_back(vs11Win32generatorName);
  49. names.push_back(vs11Win64generatorName);
  50. names.push_back(vs11ARMgeneratorName); }
  51. };
  52. //----------------------------------------------------------------------------
  53. cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
  54. {
  55. return new Factory;
  56. }
  57. //----------------------------------------------------------------------------
  58. cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
  59. const char* name, const char* architectureId,
  60. const char* additionalPlatformDefinition)
  61. : cmGlobalVisualStudio10Generator(name, architectureId,
  62. additionalPlatformDefinition)
  63. {
  64. this->FindMakeProgramFile = "CMakeVS11FindMake.cmake";
  65. std::string vc11Express;
  66. this->ExpressEdition = cmSystemTools::ReadRegistryValue(
  67. "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\11.0\\Setup\\VC;"
  68. "ProductDir", vc11Express, cmSystemTools::KeyWOW64_32);
  69. this->PlatformToolset = "v110";
  70. }
  71. //----------------------------------------------------------------------------
  72. void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
  73. {
  74. fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
  75. fout << "# Visual Studio 11\n";
  76. }
  77. //----------------------------------------------------------------------------
  78. cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
  79. {
  80. cmLocalVisualStudio10Generator* lg =
  81. new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11);
  82. lg->SetPlatformName(this->GetPlatformName());
  83. lg->SetGlobalGenerator(this);
  84. return lg;
  85. }