Add build flag for GCC. (#12017)

Some compiler flags restrict the compiler from making arbitrary decisions while handling undefined C/C++ behaviors.

Therefore they can be used to fix some issues caused by undefined behavior.

Signed-off-by: Yan, Xiping <xiping.yan@intel.com>

Co-authored-by: Chen Peter <peter.chen@intel.com>
This commit is contained in:
Xiping Yan 2022-07-07 02:02:04 +00:00 committed by GitHub
parent b80f724414
commit e8bd70f273
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,10 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "CMake build type" FORCE)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv)
endif()
find_package(IEDevScripts REQUIRED
PATHS "${OpenVINO_SOURCE_DIR}/cmake/developer_package"
NO_CMAKE_FIND_ROOT_PATH