From 32d0ebf3fe37e390eb07f15dc96f71cebdf36c47 Mon Sep 17 00:00:00 2001 From: ik Date: Sat, 8 Jun 2024 23:18:03 +0800 Subject: [PATCH] Fixed compilation error on MinGW-w64. The default behavior of windres.exe to read the output of the preprocessor is using popen. However, the popen implementation may be buggy on some non-English hosts, which would cause a compilation error like this: windres.exe: can't open file `page:': Invalid argument Fix by adding '--use-temp-file' option and windres.exe will use a temporary file to read instead of using opoen. Signed-off-by: ik --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb41d46c2..2d9de5800 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,6 +272,10 @@ if (WIN32) set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.h" PROPERTIES GENERATED TRUE) set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.rc" PROPERTIES GENERATED TRUE) + if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + list(APPEND CMAKE_RC_FLAGS "--use-temp-file") + endif() + list(APPEND boost_log_sources "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.h" "${CMAKE_CURRENT_BINARY_DIR}/src/windows/simple_event_log.rc"