Day044 — use 2015 along with 2017 build tool
Currentlyy, I am using Visual Studio 2017. It comes with Microsoft Build Tools 2017, aka vc15. However, I have a project that needs to be compiled with Build Tools 2015, vc14. Below is the steps I took to have that achieved.
Download the Build Tools
Download the Microsoft Build Tools 2015 from the official site.
Run the downloaded exe file to install the Build Tools.
If it is successfully installed, you will be able to find corresponding command prompt from
C:\Program Files (x86)\Microsoft Visual C++ Build Tools
C:\Program Files (x86)\Microsoft Visual C++ Build Tools
CMake
Open CMake-GUI (v3.10.2), choose your source and build directory as you desire. Then, click configure
.
In the first run, CMake cannot detect that I have installed the Build Tools 2015, so I have to specify its location.
I select both c and c++ compiler to be pointed to Visual C++ 2015 x64 Native Build Tools Command Prompt
in C:\Program Files (x86)\Microsoft Visual C++ Build Tools
Visual C++ 2015 x64 Native Build Tools Command Prompt
Click Finish
From the CMake console, you can see that the compiler is correctly identified.
The CXX compiler identification is MSVC 19.0.24231.0
The C compiler identification is MSVC 19.0.24231.0Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exeCheck for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
After a successful configuration, CMake knows the location of the Build Tools. You can just check Use default native compilers
.
Please correct me if I am wrong.
To build Visual Studio 2015 project in Visual Studio 2017 (v15.6.1), you should check VC++ 2015.3 v140 toolset for desktop (x86,x64)
in Visual Studio Installer. Then you can build solution of a Visual Studio 2015 project.
VC++ 2015.3 v140 toolset for desktop (x86,x64)