Improvements in cmake scripts (#4766)

1. Find Threads only once in IEDevScripts package
2. Small refactoring in IE Dev Package
This commit is contained in:
Ilya Lavrenov
2021-03-15 13:07:38 +03:00
committed by GitHub
parent 753f4d5918
commit 24fb09edb3
12 changed files with 33 additions and 76 deletions

View File

@@ -183,7 +183,6 @@ endfunction()
#
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
# to allows to override CMAKE_CXX_STANDARD from command line
if(NOT DEFINED CMAKE_CXX_STANDARD)

View File

@@ -1,17 +1,9 @@
# Copyright (C) 2018-2020 Intel Corporation
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
include(CheckCXXCompilerFlag)
if (ENABLE_SANITIZER OR ENABLE_THREAD_SANITIZER)
# This is workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/16609.
# It ensures pthread is searched without ASAN linking.
# Line bellow must be before adding -fsanitize=address or -fsanitize=thread to
# build options for the trick to work.
find_package(Threads REQUIRED)
endif()
if (ENABLE_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "-g -fsanitize=address -fno-omit-frame-pointer")
CHECK_CXX_COMPILER_FLAG("-fsanitize-recover=address" SANITIZE_RECOVER_SUPPORTED)