Fix for cmake 3.21.x (#6722)

* Fix for cmake 3.21.x

* Removed a lot -Wno-* compile options
This commit is contained in:
Ilya Lavrenov
2021-07-21 11:55:41 +03:00
committed by GitHub
parent 14bbf7f5e2
commit 7d85d61083
10 changed files with 17 additions and 15 deletions
@@ -40,7 +40,7 @@ if (DEFINED SANITIZER_COMPILER_FLAGS)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=gold")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$" AND NOT WIN32)
elseif(OV_COMPILER_IS_CLANG AND NOT WIN32)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
endif()
@@ -23,7 +23,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release")
if (NOT ENABLE_SANITIZER)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -s")
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
elseif(OV_COMPILER_IS_CLANG)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if (NOT ENABLE_SANITIZER)
+1 -1
View File
@@ -58,7 +58,7 @@ ie_option (VERBOSE_BUILD "shows extra information about build" OFF)
ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF)
ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "CMAKE_CXX_COMPILER_ID MATCHES ^(Apple)?Clang$; NOT WIN32" OFF)
ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG; NOT WIN32" OFF)
#
# Check features
@@ -55,3 +55,9 @@ endif()
if(UNIX AND NOT APPLE)
set(LINUX ON)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
set(OV_COMPILER_IS_CLANG ON)
else()
set(OV_COMPILER_IS_CLANG OFF)
endif()
@@ -34,8 +34,7 @@ ie_mark_target_as_cc(${TARGET_NAME})
if(SELECTIVE_BUILD STREQUAL "ON")
# After disabling a block of code, some variables might be unused.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
target_compile_options(${TARGET_NAME} PRIVATE -Wno-unused-variable)
endif()
endif()
@@ -63,10 +63,8 @@ if(NGRAPH_USE_PROTOBUF_LITE)
target_compile_definitions(onnx_importer PRIVATE NGRAPH_USE_PROTOBUF_LITE)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
target_compile_options(onnx_importer PRIVATE -Wno-undef -Wno-reserved-id-macro -Wno-switch-enum
-Wno-invalid-offsetof -Wno-shorten-64-to-32 -Wno-unused-macros -Wno-missing-variable-declarations
-Wno-unused-private-field -Wno-shadow -Wno-deprecated PUBLIC -Wno-undefined-func-template)
if(OV_COMPILER_IS_CLANG)
target_compile_options(onnx_importer PRIVATE -Wno-undef)
endif()
install(TARGETS onnx_importer EXPORT ngraphTargets
+1 -1
View File
@@ -618,7 +618,7 @@ if (NGRAPH_ONNX_IMPORT_ENABLE AND NOT NGRAPH_USE_PROTOBUF_LITE)
target_include_directories(unit-test PRIVATE ${ONNX_IMPORTER_SRC_DIR}/src)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
if (OV_COMPILER_IS_CLANG)
target_compile_options(unit-test PRIVATE -Wno-undef -Wno-reserved-id-macro)
endif()
@@ -25,8 +25,7 @@ elseif(SELECTIVE_BUILD STREQUAL "ON")
target_compile_definitions(${TARGET_NAME} INTERFACE SELECTIVE_BUILD)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR OV_COMPILER_IS_CLANG)
# After disabling a block of code, some variables might be unused.
target_compile_options(${TARGET_NAME} INTERFACE
-Wno-unused-function
+1 -1
View File
@@ -21,7 +21,7 @@ macro(onnx_set_target_properties)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(onnx PRIVATE /WX-)
elseif(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
target_compile_options(onnx PRIVATE -Wno-all)
target_compile_options(onnx_proto PRIVATE -Wno-all -Wno-unused-variable)
endif()
+2 -2
View File
@@ -13,7 +13,7 @@ if(SUGGEST_OVERRIDE_SUPPORTED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
if(OV_COMPILER_IS_CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
endif()
@@ -58,7 +58,7 @@ else()
set(Protobuf_LIBRARIES libprotobuf)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(_proto_libs ${Protobuf_LIBRARIES})
if(TARGET libprotoc)
list(APPEND _proto_libs libprotoc)