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>
This commit is contained in:
parent
8635ac2330
commit
65624c39e3
|
@ -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.
|
|
@ -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
|
||||
|
|
|
@ -178,6 +178,7 @@ Variables that Describe the System
|
|||
/variable/MSVC10
|
||||
/variable/MSVC11
|
||||
/variable/MSVC12
|
||||
/variable/MSVC14
|
||||
/variable/MSVC60
|
||||
/variable/MSVC70
|
||||
/variable/MSVC71
|
||||
|
|
|
@ -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.
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -426,6 +426,8 @@ if (WIN32)
|
|||
cmGlobalVisualStudio11Generator.cxx
|
||||
cmGlobalVisualStudio12Generator.h
|
||||
cmGlobalVisualStudio12Generator.cxx
|
||||
cmGlobalVisualStudio14Generator.h
|
||||
cmGlobalVisualStudio14Generator.cxx
|
||||
cmGlobalVisualStudioGenerator.cxx
|
||||
cmGlobalVisualStudioGenerator.h
|
||||
cmIDEFlagTable.h
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
|
@ -40,7 +40,9 @@ public:
|
|||
VS9 = 90,
|
||||
VS10 = 100,
|
||||
VS11 = 110,
|
||||
VS12 = 120
|
||||
VS12 = 120,
|
||||
/* VS13 = 130 was skipped */
|
||||
VS14 = 140
|
||||
};
|
||||
|
||||
cmLocalVisualStudioGenerator(VSVersion v);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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++)
|
||||
{
|
||||
|
@ -1778,6 +1780,8 @@ void cmake::AddDefaultGenerators()
|
|||
cmGlobalVisualStudio11Generator::NewFactory());
|
||||
this->Generators.push_back(
|
||||
cmGlobalVisualStudio12Generator::NewFactory());
|
||||
this->Generators.push_back(
|
||||
cmGlobalVisualStudio14Generator::NewFactory());
|
||||
this->Generators.push_back(
|
||||
cmGlobalVisualStudio71Generator::NewFactory());
|
||||
this->Generators.push_back(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue