Saturday, October 30, 2021

[SOLVED] Failure to build open62541 with CMake on Windows

Issue

I am trying to build the library on Windows with CMake. The whole process is new to me, so please excuse this basic question. I followed the instructions under 2.1.2 of the current open62541 manual (Release 1.2.0-rc2-45-gf4270ceb). After executing cmake.exe, I got the following error:

<path-to>\open62541\build>"C:\Program Files\CMake\bin\cmake.exe" .. -G "Visual Studio 14 2015"
-- Selecting Windows SDK version  to target Windows 10.0.19043.
CMake Error at CMakeLists.txt:5 (project):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:

    Das System kann die angegebene Datei nicht finden



-- Configuring incomplete, errors occurred!

The German sentence towards the end translates to The system cannot find the specified file.

I have found several files called MSBuild.exe on my computer and added them all to the PATH environment. This has not resolved the issue.

I tried using the prebuilt single files, but as far as I understand, these are for Linux systems and can not be used with Windows, correct?

Any inputs how I can proceed to obtain a working build are highly appreciated. Thanks!

[Edit:] I was able to continue the build process by doing two things:

  • Changed the Visual Studio Version to the current one in the command (Visual Studio 16 2019)
  • Installed the Windows 10 SDK in Visual Studio as shown here.

Now I am stuck at the step where is says in the manual "Then open buildopen62541.sln in Visual Studio 2015 and build as usual." Any hints what exactly I am supposed to do?


Solution

To run Visual Studio on an .sln file means to open it in VS, then click on Build in the menu bar and then on Build solution. This was new for me, thanks everyone for hinting me in the right direction.



Answered By - Dave