Skip to content

Commit ff2741a

Browse files
Derive MinGW GCC lib dir dynamically instead of hard-coding version
Co-authored-by: JohannesLorenz <1042576+JohannesLorenz@users.noreply.github.com>
1 parent 948c7aa commit ff2741a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,29 @@ function(rtosc_add_test testname testbinary)
189189
set(_runner_temp "")
190190
endif()
191191

192+
# Dynamically find the GCC private lib directory for the MinGW cross-compiler.
193+
# This avoids hard-coding the GCC version (e.g. "13-win32") which changes
194+
# across runner image updates and different toolchain installations.
195+
execute_process(
196+
COMMAND x86_64-w64-mingw32-gcc -print-libgcc-file-name
197+
OUTPUT_VARIABLE _mingw_libgcc_file
198+
OUTPUT_STRIP_TRAILING_WHITESPACE
199+
ERROR_QUIET
200+
)
201+
if(_mingw_libgcc_file)
202+
get_filename_component(_mingw_gcc_lib_dir "${_mingw_libgcc_file}" DIRECTORY)
203+
else()
204+
set(_mingw_gcc_lib_dir "")
205+
endif()
206+
192207
# Compose WINEPATH
193208
set(_winepath
194209
"/usr/x86_64-w64-mingw32/bin/;"
195210
"/usr/x86_64-w64-mingw32/lib/;"
196-
"/usr/lib/gcc/x86_64-w64-mingw32/13-win32"
197211
)
212+
if(_mingw_gcc_lib_dir)
213+
list(APPEND _winepath "${_mingw_gcc_lib_dir}")
214+
endif()
198215

199216
if(_runner_temp)
200217
list(APPEND _winepath

0 commit comments

Comments
 (0)