Newbie needs help on Step4

I’m completely new to CMake, so I’m running through the Tutorial.
Everything seems to be working fine, until I reach Step4.

I have cmake installed in c:\program files\cmake and the code files in C:\Cmake\cmake-3.20.3\Help\guide\tutorial

Iam using Visual Studio Code as coding tool.

After going through the steps (Up to ‘Testing Support’), I have created Step4_build folder and I’m executing the build:

PS C:\Cmake\cmake-3.20.3\Help\guide\tutorial\Step4_build> & ‘C:\Program Files\cmake\bin\cmake’ …\Step4
– Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
– Configuring done
– Generating done
– Build files have been written to: C:/Cmake/cmake-3.20.3/Help/guide/tutorial/Step4_build
PS C:\Cmake\cmake-3.20.3\Help\guide\tutorial\Step4_build> & ‘C:\Program Files\cmake\bin\cmake’ --build .
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

MathFunctions.vcxproj → C:\Cmake\cmake-3.20.3\Help\guide\tutorial\Step4_build\MathFunctions\Debug\MathFunctions.lib

Tutorial.vcxproj → C:\Cmake\cmake-3.20.3\Help\guide\tutorial\Step4_build\Debug\Tutorial.exe

But when I’m trying to create the install

PS C:\Cmake\cmake-3.20.3\Help\guide\tutorial\Step4_build> & ‘C:\Program Files\cmake\bin\cmake’ --install .
– Install configuration: “Release”
CMake Error at cmake_install.cmake:39 (file):
file cannot create directory: C:/Program Files (x86)/Tutorial/bin. Maybe need administrative privileges.

So I used the prefix solution
PS C:\Cmake\cmake-3.20.3\Help\guide\tutorial\Step4_build> & ‘C:\Program Files\cmake\bin\cmake’ --install . --prefix "C:\Cmake\cmake-3.20.3\Help\guide\tutorial\Step4_build"
CMake Error at cmake_install.cmake:39 (file):
file INSTALL cannot find
No error.

If the intall fails, then why is it “No Error”. But why did it fail in the first place.

Can someone help to find out what’s wrong?

I compared the modified Step4 folder with the Step5 folder and all files are completely identical.

Any support is appreciated.

Kind regards


It seems that your install prefix is somewhere in a place that your user does not have rights to. I suppose this should be mentioned in the docs.

Cc: @betsy.mcphail

Based on the output you have built the “Debug” configuration, but the installation tried to install a “Release” configuration.

As I do not have experience with the VS or other MultiConfig generators, I’m not sure about the solution. But try to add a --config Release to your build command.

That might be another issue, but I don’t think a config mismatch would be the root cause of permission denied errors on a directory that either would want.

Yes, that first install command lacks permission as the error message says:

For the default program directories on Windows you usually need admin rights.
In case of a exe/msi Installer, you usually get a Popup to input your credentials. But I assume here the make just tries to copy the files.

Perhaps the tutorial should mention that installations to the default directories often require sudo/admin rights. And if you don’t have them you need to use a prefix, which is also explained in the tutorial.