From 812c08bc7f0b191705f673b2582b86aa03940367 Mon Sep 17 00:00:00 2001 From: SOULIER Laurent <laurent.soulier@cea.fr> Date: Tue, 12 Dec 2023 15:01:54 +0100 Subject: [PATCH] [FIX][MIN] silence C4477 on msvc --- CMakeLists.txt | 4 +++- unit_tests/CMakeLists.txt | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dcf17ec..849473b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,9 @@ target_compile_options(${module_name} PRIVATE $<$<CXX_COMPILER_ID:GNU>:${STRICT_ALIASING_FLAGS}>) target_compile_options(${module_name} PRIVATE $<$<CXX_COMPILER_ID:MSVC>: -/W4 /DWIN32 /D_WINDOWS /GR /EHsc /MP /Zc:__cplusplus /Zc:preprocessor /permissive- ${SANITIZE_MSVC_FLAGS}>) +/W4 /wd4477 /DWIN32 /D_WINDOWS /GR /EHsc /MP /Zc:__cplusplus /Zc:preprocessor /permissive- ${SANITIZE_MSVC_FLAGS}>) +# TODO FIXME: I'm not sure it's a good idea to propagate this option but, at this point, it was the only way that worked to silence C4477 +target_compile_options(${module_name} PUBLIC $<$<CXX_COMPILER_ID:MSVC>: /wd4477>) target_link_options(${module_name} PUBLIC $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:${SANITIZE_FLAGS}>) #target_link_options(${module_name} PUBLIC $<$<CXX_COMPILER_ID:MSVC>:${SANITIZE_MSVC_FLAGS}>) diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 8314a9ca..4205e4bc 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -53,9 +53,11 @@ $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID: -Wall -Wextra -Wold-style-cast -Winline -pedantic -Werror=narrowing -Wshadow $<$<BOOL:${WERROR}>:-Werror> ${SANITIZE_FLAGS}>) target_compile_options(tests${module_name} PRIVATE $<$<CXX_COMPILER_ID:GNU>:${STRICT_ALIASING_FLAGS}>) -target_compile_options(tests${module_name} PRIVATE +target_compile_options(${module_name} PRIVATE $<$<CXX_COMPILER_ID:MSVC>: -/W4 /Wd4477 /DWIN32 /D_WINDOWS /GR /EHsc /MP /Zc:__cplusplus /Zc:preprocessor /permissive- ${SANITIZE_MSVC_FLAGS}>) +/W4 /wd4477 /DWIN32 /D_WINDOWS /GR /EHsc /MP /Zc:__cplusplus /Zc:preprocessor /permissive- ${SANITIZE_MSVC_FLAGS}>) +# TODO FIXME: I'm not sure it's a good idea to propagate this option but, at this point, it was the only way that worked to silence C4477 +target_compile_options(${module_name} PUBLIC $<$<CXX_COMPILER_ID:MSVC>: /wd4477>) target_link_options(tests${module_name} PUBLIC $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:${SANITIZE_FLAGS}>) #target_link_options(tests${module_name} PUBLIC $<$<CXX_COMPILER_ID:MSVC>:${SANITIZE_MSVC_FLAGS}>) -- GitLab