From aba39e720dbeb9b642ddcc351ec64f14cf52b39e Mon Sep 17 00:00:00 2001 From: Frank Lin Date: Thu, 2 Jul 2026 22:33:01 -0700 Subject: [PATCH] Replace add_definitions(/W4) with add_compile_options to avoid rc.exe breakage librime exposes this latent bug by building OpenCC with Ninja: add_definitions(/W4) propagates /W4 into the RC file compile command, causing rc.exe to fail with RC1106. OpenCC's own CI uses the Visual Studio generator (MSBuild), which keeps C++ and RC compiler flags in separate vcxproj sections, so the issue was not visible there. --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 176dfb343..8dd191775 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,10 +294,8 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") add_compile_options(-O0 -g3) endif () elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - add_definitions( - /W4 - /D "_CRT_SECURE_NO_WARNINGS" - ) + add_compile_options(/W4) + add_definitions(/D "_CRT_SECURE_NO_WARNINGS") endif() if (NOT BUILD_SHARED_LIBS)