diff options
author | Brad King <brad.king@kitware.com> | 2014-06-24 19:39:11 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-06-25 18:51:19 (GMT) |
commit | 65624c39e3f435a601760bfcb01d9cafbbfb56c1 (patch) | |
tree | cb19db486fefa04d01a2bd4a8f68b380ced4100c | |
parent | 8635ac2330641adfbe45b81047288a6074134ee1 (diff) | |
download | CMake-65624c39e3f435a601760bfcb01d9cafbbfb56c1.zip CMake-65624c39e3f435a601760bfcb01d9cafbbfb56c1.tar.gz CMake-65624c39e3f435a601760bfcb01d9cafbbfb56c1.tar.bz2 |
VS14: Add Visual Studio 14 generator (#14982)
Call the generator "Visual Studio 14" without any year because this
version of VS does not provide a year in the product name.
Copy cmGlobalVisualStudio12Generator to cmGlobalVisualStudio14Generator
and update version numbers accordingly. Add the VS14 enumeration value.
Teach the platform module Windows-MSVC to set MSVC14 and document the
variable. Teach module InstallRequiredSystemLibraries to look for the VS
14 runtime libraries.
Teach tests CheckCompilerRelatedVariables, VSExternalInclude, and
RunCMake.GeneratorToolset to treat VS 14 as they do VS 10, 11, and 12.
Co-Author: Pawel Stopinski <diokhan@go2.pl>
-rw-r--r-- | Help/generator/Visual Studio 14.rst | 9 | ||||
-rw-r--r-- | Help/manual/cmake-generators.7.rst | 1 | ||||
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/variable/MSVC14.rst | 6 | ||||
-rw-r--r-- | Help/variable/MSVC_VERSION.rst | 5 | ||||
-rw-r--r-- | Modules/InstallRequiredSystemLibraries.cmake | 8 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 5 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.cxx | 116 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio14Generator.h | 44 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 1 | ||||
-rw-r--r-- | Source/cmake.cxx | 4 | ||||
-rw-r--r-- | Tests/CheckCompilerRelatedVariables/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake | 4 | ||||
-rw-r--r-- | Tests/VSExternalInclude/CMakeLists.txt | 4 |
16 files changed, 209 insertions, 9 deletions
diff --git a/Help/generator/Visual Studio 14.rst b/Help/generator/Visual Studio 14.rst new file mode 100644 index 0000000..7f4fdc3 --- /dev/null +++ b/Help/generator/Visual Studio 14.rst @@ -0,0 +1,9 @@ +Visual Studio 14 +---------------- + +Generates Visual Studio 14 project files. + +It is possible to append a space followed by the platform name to +create project files for a specific target platform. E.g. +"Visual Studio 14 Win64" will create project files for the +x64 processor; "Visual Studio 14 ARM" for ARM. diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst index 8d0c704..7f5093f 100644 --- a/Help/manual/cmake-generators.7.rst +++ b/Help/manual/cmake-generators.7.rst @@ -64,6 +64,7 @@ one may launch CMake from any environment. /generator/Visual Studio 10 2010 /generator/Visual Studio 11 2012 /generator/Visual Studio 12 2013 + /generator/Visual Studio 14 /generator/Xcode Extra Generators diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index df434c5..d0d01a9 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -178,6 +178,7 @@ Variables that Describe the System /variable/MSVC10 /variable/MSVC11 /variable/MSVC12 + /variable/MSVC14 /variable/MSVC60 /variable/MSVC70 /variable/MSVC71 diff --git a/Help/variable/MSVC14.rst b/Help/variable/MSVC14.rst new file mode 100644 index 0000000..33c782b --- /dev/null +++ b/Help/variable/MSVC14.rst @@ -0,0 +1,6 @@ +MSVC14 +------ + +True when using Microsoft Visual C 14.0 + +Set to true when the compiler is version 14.0 of Microsoft Visual C. diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst index d74114e..ef3b0b5 100644 --- a/Help/variable/MSVC_VERSION.rst +++ b/Help/variable/MSVC_VERSION.rst @@ -3,9 +3,7 @@ MSVC_VERSION The version of Microsoft Visual C/C++ being used if any. -Known version numbers are: - -:: +Known version numbers are:: 1200 = VS 6.0 1300 = VS 7.0 @@ -15,3 +13,4 @@ Known version numbers are: 1600 = VS 10.0 1700 = VS 11.0 1800 = VS 12.0 + 1900 = VS 14.0 diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index 2fc8c04..349cbf5 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -198,6 +198,10 @@ if(MSVC) MSVCRT_FILES_FOR_VERSION(12) endif() + if(MSVC14) + MSVCRT_FILES_FOR_VERSION(14) + endif() + if(CMAKE_INSTALL_MFC_LIBRARIES) if(MSVC70) set(__install__libs ${__install__libs} @@ -367,6 +371,10 @@ if(MSVC) if(MSVC12) MFC_FILES_FOR_VERSION(12) endif() + + if(MSVC14) + MFC_FILES_FOR_VERSION(14) + endif() endif() foreach(lib diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 5732170..bb6d991 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -85,6 +85,7 @@ if(NOT MSVC_VERSION) set(MSVC10) set(MSVC11) set(MSVC12) + set(MSVC14) set(MSVC60) set(MSVC70) set(MSVC71) @@ -92,7 +93,9 @@ if(NOT MSVC_VERSION) set(MSVC90) set(CMAKE_COMPILER_2005) set(CMAKE_COMPILER_SUPPORTS_PDBTYPE) - if(NOT "${_compiler_version}" VERSION_LESS 18) + if(NOT "${_compiler_version}" VERSION_LESS 19) + set(MSVC14 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 18) set(MSVC12 1) elseif(NOT "${_compiler_version}" VERSION_LESS 17) set(MSVC11 1) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index c3c24fe..3838cb0 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -426,6 +426,8 @@ if (WIN32) cmGlobalVisualStudio11Generator.cxx cmGlobalVisualStudio12Generator.h cmGlobalVisualStudio12Generator.cxx + cmGlobalVisualStudio14Generator.h + cmGlobalVisualStudio14Generator.cxx cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.h cmIDEFlagTable.h diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx new file mode 100644 index 0000000..9bde0ad --- /dev/null +++ b/Source/cmGlobalVisualStudio14Generator.cxx @@ -0,0 +1,116 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2014 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmGlobalVisualStudio14Generator.h" +#include "cmLocalVisualStudio10Generator.h" +#include "cmMakefile.h" + +static const char vs14generatorName[] = "Visual Studio 14"; + +class cmGlobalVisualStudio14Generator::Factory + : public cmGlobalGeneratorFactory +{ +public: + virtual cmGlobalGenerator* CreateGlobalGenerator( + const std::string& genName) const + { + if(strncmp(genName.c_str(), vs14generatorName, + sizeof(vs14generatorName) - 1) != 0) + { + return 0; + } + const char* p = genName.c_str() + sizeof(vs14generatorName) - 1; + if(!*p) + { + return new cmGlobalVisualStudio14Generator( + genName, "", ""); + } + if(*p++ != ' ') + { return 0; } + if(strcmp(p, "Win64") == 0) + { + return new cmGlobalVisualStudio14Generator( + genName, "x64", "CMAKE_FORCE_WIN64"); + } + if(strcmp(p, "ARM") == 0) + { + return new cmGlobalVisualStudio14Generator( + genName, "ARM", ""); + } + return 0; + } + + virtual void GetDocumentation(cmDocumentationEntry& entry) const + { + entry.Name = vs14generatorName; + entry.Brief = "Generates Visual Studio 14 project files."; + } + + virtual void GetGenerators(std::vector<std::string>& names) const + { + names.push_back(vs14generatorName); + names.push_back(vs14generatorName + std::string(" ARM")); + names.push_back(vs14generatorName + std::string(" Win64")); + } +}; + +//---------------------------------------------------------------------------- +cmGlobalGeneratorFactory* cmGlobalVisualStudio14Generator::NewFactory() +{ + return new Factory; +} + +//---------------------------------------------------------------------------- +cmGlobalVisualStudio14Generator::cmGlobalVisualStudio14Generator( + const std::string& name, const std::string& platformName, + const std::string& additionalPlatformDefinition) + : cmGlobalVisualStudio12Generator(name, platformName, + additionalPlatformDefinition) +{ + std::string vc14Express; + this->ExpressEdition = cmSystemTools::ReadRegistryValue( + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\14.0\\Setup\\VC;" + "ProductDir", vc14Express, cmSystemTools::KeyWOW64_32); + this->DefaultPlatformToolset = "v140"; +} + +//---------------------------------------------------------------------------- +bool +cmGlobalVisualStudio14Generator::MatchesGeneratorName( + const std::string& name) const +{ + return name == this->GetName(); +} + +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio14Generator::WriteSLNHeader(std::ostream& fout) +{ + // Visual Studio 14 writes .sln format 12.00 + fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; + if (this->ExpressEdition) + { + fout << "# Visual Studio Express 14 for Windows Desktop\n"; + } + else + { + fout << "# Visual Studio 14\n"; + } +} + +//---------------------------------------------------------------------------- +cmLocalGenerator *cmGlobalVisualStudio14Generator::CreateLocalGenerator() +{ + cmLocalVisualStudio10Generator* lg = + new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS14); + lg->SetPlatformName(this->GetPlatformName()); + lg->SetGlobalGenerator(this); + return lg; +} diff --git a/Source/cmGlobalVisualStudio14Generator.h b/Source/cmGlobalVisualStudio14Generator.h new file mode 100644 index 0000000..7074119 --- /dev/null +++ b/Source/cmGlobalVisualStudio14Generator.h @@ -0,0 +1,44 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2014 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmGlobalVisualStudio14Generator_h +#define cmGlobalVisualStudio14Generator_h + +#include "cmGlobalVisualStudio12Generator.h" + + +/** \class cmGlobalVisualStudio14Generator */ +class cmGlobalVisualStudio14Generator: + public cmGlobalVisualStudio12Generator +{ +public: + cmGlobalVisualStudio14Generator(const std::string& name, + const std::string& platformName, + const std::string& additionalPlatformDefinition); + static cmGlobalGeneratorFactory* NewFactory(); + + virtual bool MatchesGeneratorName(const std::string& name) const; + + virtual void WriteSLNHeader(std::ostream& fout); + + ///! create the correct local generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** TODO: VS 14 user macro support. */ + virtual std::string GetUserMacrosDirectory() { return ""; } + + virtual const char* GetToolsVersion() { return "14.0"; } +protected: + virtual const char* GetIDEVersion() { return "14.0"; } +private: + class Factory; +}; +#endif diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 3bf4f43..d26c2ea 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -40,7 +40,9 @@ public: VS9 = 90, VS10 = 100, VS11 = 110, - VS12 = 120 + VS12 = 120, + /* VS13 = 130 was skipped */ + VS14 = 140 }; cmLocalVisualStudioGenerator(VSVersion v); diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 81adb56..2cbf5db 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -68,6 +68,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmLocalVisualStudioGenerator::VS10: case cmLocalVisualStudioGenerator::VS11: case cmLocalVisualStudioGenerator::VS12: + case cmLocalVisualStudioGenerator::VS14: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 86d3766..a051c87 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -58,6 +58,7 @@ # include "cmGlobalVisualStudio10Generator.h" # include "cmGlobalVisualStudio11Generator.h" # include "cmGlobalVisualStudio12Generator.h" +# include "cmGlobalVisualStudio14Generator.h" # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalJOMMakefileGenerator.h" @@ -1380,6 +1381,7 @@ int cmake::ActualConfigure() {"10.0", "Visual Studio 10 2010"}, {"11.0", "Visual Studio 11 2012"}, {"12.0", "Visual Studio 12 2013"}, + {"14.0", "Visual Studio 14"}, {0, 0}}; for(int i=0; version[i].MSVersion != 0; i++) { @@ -1779,6 +1781,8 @@ void cmake::AddDefaultGenerators() this->Generators.push_back( cmGlobalVisualStudio12Generator::NewFactory()); this->Generators.push_back( + cmGlobalVisualStudio14Generator::NewFactory()); + this->Generators.push_back( cmGlobalVisualStudio71Generator::NewFactory()); this->Generators.push_back( cmGlobalVisualStudio8Generator::NewFactory()); diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 69cfdb8..87b7f1a 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -40,6 +40,9 @@ endif() if(DEFINED MSVC12) math(EXPR msvc_total "${msvc_total} + 1") endif() +if(DEFINED MSVC14) + math(EXPR msvc_total "${msvc_total} + 1") +endif() echo_var(MSVC) echo_var(MSVC60) @@ -50,6 +53,7 @@ echo_var(MSVC90) echo_var(MSVC10) echo_var(MSVC11) echo_var(MSVC12) +echo_var(MSVC14) echo_var(MSVC_IDE) if(MSVC) diff --git a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake index d39f33f..6220657 100644 --- a/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake +++ b/Tests/RunCMake/GeneratorToolset/RunCMakeTest.cmake @@ -3,7 +3,7 @@ include(RunCMake) set(RunCMake_GENERATOR_TOOLSET "") run_cmake(NoToolset) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_GENERATOR_TOOLSET "Test Toolset") run_cmake(TestToolset) else() @@ -17,7 +17,7 @@ set(RunCMake_TEST_OPTIONS -T "Extra Toolset") run_cmake(TwoToolsets) unset(RunCMake_TEST_OPTIONS) -if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[012]|Xcode" AND NOT XCODE_BELOW_3) +if("${RunCMake_GENERATOR}" MATCHES "Visual Studio 1[0124]|Xcode" AND NOT XCODE_BELOW_3) set(RunCMake_TEST_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${RunCMake_SOURCE_DIR}/TestToolset-toolchain.cmake) run_cmake(TestToolsetToolchain) unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt index 8fc2871..cfcccec 100644 --- a/Tests/VSExternalInclude/CMakeLists.txt +++ b/Tests/VSExternalInclude/CMakeLists.txt @@ -6,7 +6,7 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6") else() set(PROJECT_EXT vcproj) endif() -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") set(PROJECT_EXT vcxproj) endif() @@ -54,7 +54,7 @@ add_dependencies(VSExternalInclude lib2) # and the sln file can no longer be the only source # of that depend. So, for VS 10 make the executable # depend on lib1 and lib2 -if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[012]") +if(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[0124]") add_dependencies(VSExternalInclude lib1) endif() |