CMake GUI error on 'Open Project'

Hello everyone,

I noticed the following behavior of CMake on Windows in combination with Visual Studio: If I configure the project using the CMake GUI and use Configure/Generate to create a Visual Studio solution (*.sln), thereafter pressing ‘Open Project’ results in an error message: Microsoft Visual Studio: Unknown error, please refer to ActivityLog.xml. I tried to find the log file, however according to what I found out about it, it requires calling devenv.exe with the /log switch to create it in the %APPDATA%\Microsoft\VisualStudio\XX.X_XXXX directory and while pressing ‘Open Project’, this file is not created (presumably the /log flag is not set).

Interestingly, manually opening the generated VS solution works fine. Even more, closing and reopening CMake GUI (the last configured source and build directories are read from the registry) and pressing ‘Open Project’ works fine as well. But after another Configure/Generate iteration, the same error message reappears.

According to my tests, this behavior is only present with VS Community 2019 and 2022 while the respective Professional versions open the solution fine even after Configure/Generate without restarting the CMake GUI program.

I suspect that running Configure/Generate sets up something temporarily (e.g. environment variables or something similar) that cause some weird inference with VS Community. Does anyone ran into this issue as well and might know a fix? Thanks in advance!

I am using the VS 2022 Professional versions ,but there is the same problem

Thanks for pointing out!
So maybe anybody of the CMake team knows how to fix it?