From 2a5f1cfda7351f8c96dc1cab89cc030e1f28a00e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 3 Jan 2022 21:50:19 +0400 Subject: [PATCH] cmake: add -fno-common when !MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 713e8534..a60428a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,10 +228,12 @@ endif() # # setup warnings # -# We're treating -fno-common like a warning: it makes the linker more -# strict, because on some systems the linker is *always* this strict -string(APPEND CMAKE_C_FLAGS " -fno-common") -string(APPEND CMAKE_CXX_FLAGS " -fno-common") +if(NOT MSVC) + # We're treating -fno-common like a warning: it makes the linker more + # strict, because on some systems the linker is *always* this strict + string(APPEND CMAKE_C_FLAGS " -fno-common") + string(APPEND CMAKE_CXX_FLAGS " -fno-common") +endif() option(ENABLE_WERROR "Unconditionally make all compiler warnings fatal" OFF)