NanBlanc
NanBlanc

Reputation: 135

CMake Can't find MSBuild.exe for VS 14 2015

I'm building a new project using precompiled librairies in Visual Studio 14 2015 win64. So when i configure my project Cmake, i'm selecting this compiler, but get the error :

CMake Error at CMakeLists.txt:2 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
Specified file is not found

Why Cmake isn't able to find the location of this compiler ?

I have visual studio community 2017, and installed the add-on for Visual Studio 14 2015 win64. I can already make my solution work by setting up my project with Visual Studio 15 2017 win64, then manually change to 2015.

What should i do for Cmake to do it directly with VS14 2015 compiler ?

Upvotes: 0

Views: 1896

Answers (1)

fdk1342
fdk1342

Reputation: 3564

The VS development shell is buried in the start menu (Visual Studio 2017->Visual studio Tools->VC) and there are several to choose from.

Then you can use the command line to run cmake -G "Visual Studio 14 2015 Win64".

If this will work or not I'm not entirely sure because the generator will look for registry keys for "Visual Studio 14 2015" to determine the path to the correct msbuild. But you don't have it installed because you are using visual studio community 2017 which works entirely different.

So when cmake fails to find msbuild for VS14 it'll default to whatever is in the path and that will be msbuild for VS 2017.

That's when you'll find out if the add-on is compatible with cmake VS14 projects and tool-sets.

It may be that the add-on is simply the VS14 tool-sets. If that is the case you want to generate a VS17 project and use the -T option to use the VS14 tool-set.

Also Visual Studio and CMake refer to msbuild as the build tool. The -T option is to choose the platform toolset which is the version of the compiler to use.

Upvotes: 1

Related Questions