VS2017 Preview compiler gets selected instead of VS2017, when both are installed side-by-side
I've got VS2017 and VS2017 Preview installed side-by-side (officially supported by MS and they go into completely separate directories).
I'm in a VS2017 (MSVC_VERSION 1910) 64-bit command prompt:
** Visual Studio 2017 Developer Command Prompt v15.0.26430.14 ** Copyright (c) 2017 Microsoft Corporation
[vcvarsall.bat] Environment initialized for: 'x64'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise>cl --version Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
Run cmake-gui
from there:
C:\opencv\opencv-git\build-vs2017>cmake-gui ..\opencv
Now CMake uses the VS2017 Preview compiler (MSVC_VERSION 1911) instead of the VS2017 (without Preview) compiler that I've started the command prompt from:
The CXX compiler identification is MSVC 19.11.25415.0
The C compiler identification is MSVC 19.11.25415.0
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Enterprise/VC/Tools/MSVC/14.11.25415/bin/HostX86/x64/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Enterprise/VC/Tools/MSVC/14.11.25415/bin/HostX86/x64/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Enterprise/VC/Tools/MSVC/14.11.25415/bin/HostX86/x64/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/Preview/Enterprise/VC/Tools/MSVC/14.11.25415/bin/HostX86/x64/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done