Windows: embed a manifest that declares longPathAware

With LongPathsEnabled set in the registry, Windows lets a program open
paths of 260 characters or more only if its manifest says longPathAware.
QElectroTech.exe so far carried the toolchain's default manifest. This one
repeats what the default declares (supported Windows versions, asInvoker)
and adds longPathAware. MSVC takes the .manifest as a source; MinGW gets it
through a small resource file.

Follow-up to #1178 (symbols in deep folders).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-02 22:25:46 +13:00
parent 808d6a3c5b
commit 4c89f37fd8
3 changed files with 51 additions and 0 deletions
+12
View File
@@ -159,6 +159,18 @@ if(WIN32)
${QET_DIR}/qelectrotech.qrc
${QET_DIR}/ico/icon-themes.qrc
)
# Our own manifest (it declares longPathAware). MSVC merges a .manifest
# listed as a source; MinGW needs it embedded through a resource file,
# and ld then keeps it ahead of the toolchain's default manifest.
set(QET_MANIFEST_FILE ${QET_DIR}/build-aux/windows/qelectrotech.exe.manifest)
if(MSVC)
target_sources(${PROJECT_NAME} PRIVATE ${QET_MANIFEST_FILE})
else()
configure_file(${QET_DIR}/build-aux/windows/qelectrotech-manifest.rc.in
${CMAKE_CURRENT_BINARY_DIR}/qelectrotech-manifest.rc @ONLY)
target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/qelectrotech-manifest.rc)
endif()
else()
add_executable(
${PROJECT_NAME}
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Embeds qelectrotech.exe.manifest as the program's manifest
// (resource id 1 = CREATEPROCESS_MANIFEST_RESOURCE_ID, type 24 = RT_MANIFEST).
1 24 "@QET_MANIFEST_FILE@"
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- SPDX-License-Identifier: GPL-2.0-or-later -->
<!--
Application manifest for QElectroTech.exe, embedded by CMake on Windows.
It replaces the toolchain's default manifest, so it repeats what that one
declares (supported Windows versions, run as the invoking user) and adds
longPathAware: with LongPathsEnabled set in the registry, Windows then
lets the program open files whose full path is 260 characters or more.
-->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 and 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
</assembly>