cmGlobalVisualStudio11Generator.cxx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 (2012) 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* platformName,
  60. const char* additionalPlatformDefinition)
  61. : cmGlobalVisualStudio10Generator(name, platformName,
  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. if (this->ExpressEdition)
  76. {
  77. fout << "# Visual Studio Express 2012 for Windows Desktop\n";
  78. }
  79. else
  80. {
  81. fout << "# Visual Studio 2012\n";
  82. }
  83. }
  84. //----------------------------------------------------------------------------
  85. cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
  86. {
  87. cmLocalVisualStudio10Generator* lg =
  88. new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS11);
  89. lg->SetPlatformName(this->GetPlatformName());
  90. lg->SetGlobalGenerator(this);
  91. return lg;
  92. }
  93. //----------------------------------------------------------------------------
  94. bool cmGlobalVisualStudio11Generator::UseFolderProperty()
  95. {
  96. // Intentionally skip over the parent class implementation and call the
  97. // grand-parent class's implementation. Folders are not supported by the
  98. // Express editions in VS10 and earlier, but they are in VS11 Express.
  99. return cmGlobalVisualStudio8Generator::UseFolderProperty();
  100. }