From 9e4a4b4832219d9d11da441779ab8a3b1304bd8b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:10:17 +0000 Subject: [PATCH] cmake: Check `-Wno-*` compiler options for `leveldb` target Check for -Wfoo rather than -Wno-foo because the latter may not cause the test to fail. --- cmake/leveldb.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/leveldb.cmake b/cmake/leveldb.cmake index 823a5d8e3da..dc9968ae7b5 100644 --- a/cmake/leveldb.cmake +++ b/cmake/leveldb.cmake @@ -88,9 +88,11 @@ if(MSVC) _CRT_NONSTDC_NO_WARNINGS ) else() - target_compile_options(nowarn_leveldb_interface INTERFACE - -Wno-conditional-uninitialized - -Wno-suggest-override + try_append_cxx_flags("-Wconditional-uninitialized" TARGET nowarn_leveldb_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-conditional-uninitialized" + ) + try_append_cxx_flags("-Wsuggest-override" TARGET nowarn_leveldb_interface SKIP_LINK + IF_CHECK_PASSED "-Wno-suggest-override" ) endif()