Skip to content

Commit b4f6778

Browse files
tristanlabellecompnerd
authored andcommitted
Add workaround for MAX_PATH with object output directories.
1 parent fc3c35a commit b4f6778

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,14 @@ function Build-CMakeProject
369369
TryAdd-KeyValue $Defines CMAKE_BUILD_TYPE $BuildType
370370
TryAdd-KeyValue $Defines CMAKE_MT "mt"
371371

372+
# Workaround for running into MAX_PATH with CMake-generated output directory paths.
373+
# CMake has logic to shorten output directory paths if they approach MAX_PATH,
374+
# but when appending the filename we can still exceed MAX_PATH.
375+
# The specific issue this solves is rc.exe writing windows_version_resource.rc.res
376+
$MAX_PATH = 260
377+
$LONG_FILENAME_LENGTH = 40
378+
TryAdd-KeyValue $Defines CMAKE_OBJECT_PATH_MAX ($MAX_PATH - $LONG_FILENAME_LENGTH)
379+
372380
$CFlags = "/GS- /Gw /Gy /Oi /Oy /Zi /Zc:inline"
373381
$CXXFlags = "/GS- /Gw /Gy /Oi /Oy /Zi /Zc:inline /Zc:__cplusplus"
374382
if ($UseMSVCCompilers.Contains("C"))

0 commit comments

Comments
 (0)