Skip to content

cmake: Fix default installation directory backslash on Windows#166

Open
qhouz wants to merge 1 commit into
obsproject:masterfrom
qhouz:cmake/fix-windows-install-prefix-backslash
Open

cmake: Fix default installation directory backslash on Windows#166
qhouz wants to merge 1 commit into
obsproject:masterfrom
qhouz:cmake/fix-windows-install-prefix-backslash

Conversation

@qhouz

@qhouz qhouz commented May 16, 2026

Copy link
Copy Markdown

Description

Use file(TO_CMAKE_PATH ...) to normalize the path obtained from $ENV{ALLUSERSPROFILE}
before assigning it to CMAKE_INSTALL_PREFIX.

Motivation and Context

$ENV{ALLUSERSPROFILE} on Windows expands to C:\ProgramData — a path with backslashes.
CMake treats backslashes as escape sequences inside strings, causing a parse error when
running cmake --install:

CMake Error at build_x64/cmake_install.cmake:5 (set):
  Syntax error in cmake code at
    .../build_x64/cmake_install.cmake:5
  when parsing string
    C:\ProgramData/obs-studio/plugins
  Invalid character escape '\P'.

How Has This Been Tested?

Tested on Windows 11 x64 with Visual Studio 2026.
Ran cmake --preset windows-x64, cmake --build --preset windows-x64 --config Debug,
and cmake --install build_x64 --config Debug — no errors.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Note: clang-format and documentation checks are not applicable —
this change only modifies a CMake script file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant