Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Do not suppress warning in cpu 3rd party deps (#36659)

Oleg Pipikina01958ba317a
diff --git a/cmake/developer_package/compile_flags/functions.cmake b/cmake/developer_package/compile_flags/functions.cmake
index 4bf0ac728fa..fccce4df8c0 100644
--- a/cmake/developer_package/compile_flags/functions.cmake
+++ b/cmake/developer_package/compile_flags/functions.cmake
@@ -300,7 +300,8 @@ function(ov_disable_all_warnings)
get_target_property(target_type ${target} TYPE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (OV_COMPILER_IS_INTEL_LLVM AND WIN32))
- target_compile_options(${target} PRIVATE /WX-)
+ # restrict to C/CXX sources only
+ target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:/WX->)
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR (OV_COMPILER_IS_INTEL_LLVM AND UNIX))
target_compile_options(${target} PRIVATE -w)
# required for LTO
diff --git a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt
index 0c82f03025b..02dbdc8e353 100644
--- a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt
+++ b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt
@@ -4,21 +4,7 @@
project(intel_cpu_thirdparty)
-# Suppress warnings from thirdparty code only (not from intel_cpu/src)
-if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
- # C4849 OpenMP 'reduction' clause ignored in 'simd' directive
- ov_add_compiler_flags(/wd4849)
- # C4661 no suitable definition provided for explicit template instantiation request
- ov_add_compiler_flags(/wd4661)
- # Re-apply warning suppressions inside ov_add_onednn() function scope
- # (needed because function() creates new variable scope in CMake)
- ov_add_compiler_flags(/wd4018)
- ov_add_compiler_flags(/wd4267)
- ov_add_compiler_flags(/wd4244)
- ov_add_compiler_flags(/wd4334)
- ov_add_compiler_flags(/wd4146)
- ov_add_compiler_flags(/wd5002)
-elseif(OV_COMPILER_IS_INTEL_LLVM AND WIN32)
+if(OV_COMPILER_IS_INTEL_LLVM AND WIN32)
ov_add_compiler_flags("/Wno-microsoft-include")
endif()
@@ -164,6 +150,11 @@ function(ov_add_onednn)
add_subdirectory(onednn EXCLUDE_FROM_ALL)
+ # 3rd-party code (Windows): don't fail the build on its warnings, but don't hide them either
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (OV_COMPILER_IS_INTEL_LLVM AND WIN32))
+ target_compile_options(dnnl PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:/WX->)
+ endif()
+
# install static libraries
ov_install_static_lib(dnnl ${OV_CPACK_COMP_CORE})
@@ -192,6 +183,10 @@ endif()
if(ENABLE_MLAS_FOR_CPU)
add_subdirectory(mlas EXCLUDE_FROM_ALL)
+ # 3rd-party code (Windows): don't fail the build on its warnings, but don't hide them either
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR (OV_COMPILER_IS_INTEL_LLVM AND WIN32))
+ target_compile_options(mlas PRIVATE $<$<COMPILE_LANGUAGE:C,CXX>:/WX->)
+ endif()
ov_install_static_lib(mlas ${OV_CPACK_COMP_CORE})
endif()