Latest Visual Studio 2026 with cmake 4 breaks my cmake install script
In older builds of VS 2026 Insiders the below install lines in CMakeLists.txt worked, I think the version of cmake was still v3.xx at that time. But I have just installed the newly released stable edtion of VS 2026 with cmake 4.1.1 and the install commands below no longer work
# Install the executable into bin/
install(TARGETS ${PROJECTNAME} RUNTIME DESTINATION bin)
# Install the fonts folder into bin/
install(
DIRECTORY ${CMAKESOURCEDIR}/fonts
DESTINATION bin
)
I get these errors (when I select Install from VS menu):
[0/1] Install the project...
-- Install configuration: "Debug"
CMake Error at cmakeinstall.cmake:41 (file):
file cannot create directory: C:/Program Files
(x86)/imgui-sfml-cmake-4300-2/bin. Maybe need administrative privileges.
FAILED: CMakeFiles/install.util
C:\WINDOWS\system32\cmd.exe /C "cd /D C:\src\cpp\imgui-sfml-cmake-4300-2\out\build\x64-Debug && "C:\Program Files\Microsoft Visual Studio\18\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -P cmakeinstall.cmake"
ninja: build stopped: subcommand failed.
Has the syntax changed for the cmake install function? Why is it trying to install in C:/Program Files? In cmake 3.xx it would install into <project\name>\\out\\install\\x64-Debug\\bin.
https://redd.it/1ozac8n
@r_cpp
Post #24271
18