From 2fb134f3fe8fdeb1f36c346cff3b09a2b7a095a7 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao Date: Sat, 7 Oct 2023 13:54:51 +0800 Subject: [PATCH] qtbase: fix clang-cl warning clang-cl can't recognize the "-Ob3" parameter and it causes tons warnings when compiling, just remove it if we are using clang-cl. Change-Id: If50dccef15f771fc956eed218e97645d78d59073 Reviewed-by: Thiago Macieira --- cmake/QtCompilerOptimization.cmake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmake/QtCompilerOptimization.cmake b/cmake/QtCompilerOptimization.cmake index e1d363afab2..d2932d0ca10 100644 --- a/cmake/QtCompilerOptimization.cmake +++ b/cmake/QtCompilerOptimization.cmake @@ -92,7 +92,12 @@ endif() # Windows MSVC if(MSVC) - set(QT_CFLAGS_OPTIMIZE "-O2 -Ob3") # -Ob3 was introduced in Visual Studio 2019 version 16.0 + set(QT_CFLAGS_OPTIMIZE "-O2") + if(NOT CLANG) + # -Ob3 was introduced in Visual Studio 2019 version 16.0 + # However clang-cl can't recognize it. + string(APPEND QT_CFLAGS_OPTIMIZE " -Ob3 ") + endif() set(QT_CFLAGS_OPTIMIZE_DEBUG "-Od") set(QT_CFLAGS_OPTIMIZE_SIZE "-O1") set(QT_CFLAGS_OPTIMIZE_VALID_VALUES "/O2" "/O1" "/Od" "/Ob0" "/Ob1" "/Ob2" "/Ob3" "/O0" "-O0")