VS 2019 and cmake

I’m trying to build a C++ project with VS 2019. I install VS with

choco install visualstudio2019community

However, cmake still uses VS 2017. The logs can be found here: https://travis-ci.org/offscale/liboffkv/builds/546473832
How can I make cmake use the newest version of VS?

Specify the generator explicitly and/or set VS160COMNTOOLS envvar as per Visual Studio 16 2019 — CMake 3.14.5 Documentation to hint CMake where to look for VS 2019.

As per https://gitlab.kitware.com/cmake/cmake/issues/16339 , they look for the latest VS version by checking the registry location where normal VS installations write their locations to. But a choco package is not a “normal installation” and may not register itself there.

1 Like

How can I find out the VS installation path to set VS160COMNTOOLS? I haven’t succeeded in googling.

Use UNIX find (available on the builder) to find where choco install visualstudio2019community installs it.

Or check this locally – but then the result might need adjustment if you local Chocolatey install paths are different from Travis’.

I tried it and in my case I had to install also
choco install visualstudio2019-workload-nativedesktop

Then my setup is done by:

choco install visualstudio2019community
choco install visualstudio2019-workload-nativedesktop
export VS160COMNTOOLS="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools"
Imprint