From 3a859cc81dea5c72efb150aeda68e41defc2527e Mon Sep 17 00:00:00 2001 From: Andrei Elovikov Date: Thu, 13 Oct 2022 10:36:07 -0700 Subject: [PATCH] [SYCL][CMake] Check for compiler support before adding a flag Fixes the issue introduced by https://github.com/intel/llvm/pull/7022. --- sycl/source/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sycl/source/CMakeLists.txt b/sycl/source/CMakeLists.txt index 6aecad6b514af..f3b9084951dac 100644 --- a/sycl/source/CMakeLists.txt +++ b/sycl/source/CMakeLists.txt @@ -210,8 +210,11 @@ if (MSVC) set(SYCL_EXTRA_OPTS "/MD") endif() -# See https://github.com/llvm/llvm-project/issues/58295. -set_source_files_properties(device_selector.cpp PROPERTIES COMPILE_FLAGS -fsemantic-interposition) +check_cxx_compiler_flag(-fsemantic-interposition HAS_SEMANTIC_INTERPOSITION_FLAG) +if (HAS_SEMANTIC_INTERPOSITION_FLAG) + # See https://github.com/llvm/llvm-project/issues/58295. + set_source_files_properties(device_selector.cpp PROPERTIES COMPILE_FLAGS -fsemantic-interposition) +endif() if (WIN32) set(LIB_NAME "sycl${SYCL_MAJOR_VERSION}")