If none of the above solutions work. Stop and do a sanity check. I burned out using the wrong -G configuration line and this gave me this misleading error.
Start from the command line VS not the usual command line. You can find it in Start Menu -> Visual Studio 2015 -> MSBuild Command Prompt for VS2015
This sets all the correct paths to VS tools, etc.
Now let's see what generators are available from cmake ...
cmake -help
...<snip>... The following generators are available on this platform: Visual Studio 15 [arch] = Generates Visual Studio 15 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files. Optional [arch] can be "Win64" or "ARM". Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files. Optional [arch] can be "Win64" or "IA64". ...
Then select the appropriate line with the added arc.
mkdir _build cd _build cmake .. -G "Visual Studio 15 Win64"
Running cmake in a subdirectory makes executing "clean" easier since you can simply delete everything in this directory.
I upgraded to Visual Studio 15, but did not pay attention and tried to generate in 2012.
TrophyGeek Oct 28 '16 at 20:42 on 2016-10-28 20:42
source share