TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24271 18
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 ${CMAKE
SOURCEDIR}/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 cmake
install.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
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Oct 12, 2026cppreference-doc for Qt Creator Release cppreference C++ v2025.12.01 · cristianadam/cppref…
  2. Oct 12, 2026ACCU Overload Journal 195 - October 2026 https://accu.org/journals/overload/overload195 ht…
  3. Oct 12, 2026C++ Contracts C++ contracts are a good thing, why are people saying it's a bad thing? Anyb…
  4. Oct 11, 2026wxWidgets 3.2.12 and 3.3.4 Released https://wxwidgets.org/news/2026/10/wxwidgets-3.2.12-an…
  5. Oct 11, 2026VKRT NES Remaster — an open-source C++20 NES emulator with an observation-driven remasteri…
  6. Oct 11, 2026Right way to test async code https://redd.it/1x2wqgz @r_cpp
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →