Visual Studio 2017,Boost和CMake的版本号 [英] Version numbers for Visual Studio 2017, Boost and CMake

查看:347
本文介绍了Visual Studio 2017,Boost和CMake的版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Boost邮件列表中,我了解到VS2017具有以下是我们可能最感兴趣的版本号:

From the Boost mailing list I understand that VS2017 has the following version numbers that we would probably be most interested in:

Visual Studio           15.0
cl; C/C++ Compiler      19.10
Platform Toolset:       v141


在Visual Studio 2017 IDE中定义了以下宏:


The following macros are defined in the Visual Studio 2017 IDE:

CrtSDKReferenceVersion  14.0
MSBuildToolsVersion     15.0
PlatformToolsetVersion  141
VCToolsVersion          14.10.25017
VisualStudioVersion     15.0

在编译期间,以下变量是#define:

During compilation the following variables are #define'd:

_MSC_VER                1910
_MSC_FULL_VER           191025017

cl.exe

cl.exe is contained within an MSVC folder with the VC tools version. The complete x64 folder path is

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64

命令行列表中的

cl /Bv:

Compiler Passes:
 cl.exe:        Version 19.10.25017.0
 c1.dll:        Version 19.10.25017.0
 c1xx.dll:      Version 19.10.25017.0
 c2.dll:        Version 19.10.25017.0
 link.exe:      Version 14.10.25017.0
 mspdb140.dll:  Version 14.10.25017.0
 1033\clui.dll: Version 19.10.25017.0

注意事项mspdb140.dlllink.exe在版本14.10.25017.0中列出.

Notice mspdb140.dll and link.exe are listed with version 14.10.25017.0.

并且此处似乎应该将msvc : 14.1用作增强工具集.并且这是另一个答案,其中一些评论谈到了boost的编译器命名.

And here it seems that msvc : 14.1 should be used as the toolset for boost. And here is another answer where some comments talk about boost's compiler naming.

编译时,我会得到带有v141的库名称,例如:boost_atomic-vc141-mt-1_64.lib

When I compile I get the libraries names with v141 e.g.: boost_atomic-vc141-mt-1_64.lib

但是在CMake中,_Boost_GUESS_COMPILER_PREFIX函数具有以下功能:

But in CMake the _Boost_GUESS_COMPILER_PREFIX function has the following:

if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
  set(_boost_COMPILER "-vc150")
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19)
  set(_boost_COMPILER "-vc140")

那么应该使用哪个版本? vc141还是vc150?

So which version should be used? vc141 or vc150? Does

  • v141暗示vc141,或
  • v141暗示vc150?
  • v141 imply vc141, or does
  • v141 imply vc150?

推荐答案

要回答这个问题,最好从

In order to answer this it would be best to start with

  • Microsoft如何构建其产品
  • Microsoft称其产品为
  • Microsoft如何给它们编号.

因此,在我的系统上:

Microsoft Visual Studio Community 2017 has version number 15.0.26228.4. It contains:
|
+--Visual C++, informally VS, informally MSVC 
   (no version number to be found, but it is reasonable to infer 15.0) 
   which uses tools, such as
   |
   +--Toolset v141, composed of
      |
      +--compiler cl.exe version 19.10.25017.0 and
      +--linker link.exe version 14.10.25017.0 which
         |
         +--refers to CrtSDK version 14.0, and
         +--uses mspdb140.dll version 14.10.25017.0

显然,工具集版本应该是主要参考.特别是如果人们认为VS 2017可以同时使用v140v141进行构建.该工具集巧妙地定义了编译器和链接器.

It seems clear that the toolset version should be the main reference. Especially if one considers that VS 2017 can build both with v140 and v141. The toolset neatly defines both the compiler and linker.

那么,例如,用b2 toolset=msvc-14.0编译Boost是什么意思?我的争论是,这意味着工具集v140,而不是Microsoft Visual C ++ 14.0.

So then, what does it mean to compile Boost with b2 toolset=msvc-14.0 for example? My contention is that it means toolset v140, not Microsoft Visual C++ 14.0.

如何使用工具集v141进行编译?通常,msvc通常是VS号(例如我系统上的VS2017的15.0),但是在指定工具集时可能不准确.接下来,我们注意到Boost将创建一个名称为包含vcXXX的文件,其中vc似乎又暗示了Visual C ++版本号的非正式概念,例如15.0,但肯定不能引用它,因为它是指定的工具集.

How would one compile with toolset v141? Informally msvc is usually the VS number (e.g. 15.0 for VS2017 on my system), but that would be inaccurate when specifying a toolset. Next, we note that Boost will create a file with a name containing vcXXX where vc would again seem to imply the informal notion of a Visual C++ version number such as 15.0 but certainly cannot refer to that as it is the toolset that is being specified.

因此,要编译VS2017上的最新工具集,命令将为b2 toolset=msvc-14.1,它将生成文件名包含vc141的库.如果不是v141,它本来就不会那么混乱,但是那样就不会提醒我们正在使用Microsoft工具集.

So, compiling for the latest toolset on VS2017 the command would be b2 toolset=msvc-14.1 which will generate libraries with filenames containing vc141. It would have been less confusing had it been v141, but then there would have been no reminder that we're dealing with the Microsoft toolset.

我现在想到的命令如下:

I now think of the command as follows:

b2 toolset=msvc-14.1
           ---- ----
             |    |
             |    +-- Toolset v141
             |
             +------- Microsoft Visual C++ (version 15.0)


最后,我们可以考虑FindBoost.cmake中的CMake函数.如果编译器版本为19.10,则_boost_COMPILER应该默认为-vc141.


Finally we can consider the CMake function in FindBoost.cmake. The _boost_COMPILER should default to -vc141 if the compiler version is 19.10.

这篇关于Visual Studio 2017,Boost和CMake的版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆