From 574249cd721a3cdbb79b6e457384a55827856b6a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 21 May 2020 22:17:42 +0200 Subject: Allow FMV SSE4.2 detection to succeed on clang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the builtins were used in the feature test also in the default branch clang fails to compile the test helpfully complaining that you need to compile with sse4.2 to use that while on gcc it is optimized out as unused code and produces only a warning for that… removing the code from the default branch fixes this problem, but we adapt the code some more to avoid compilers optimizing it out in the future just in case. --- CMake/CheckCxxTarget.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'CMake') diff --git a/CMake/CheckCxxTarget.cmake b/CMake/CheckCxxTarget.cmake index 373c0be4c..17c32bfac 100644 --- a/CMake/CheckCxxTarget.cmake +++ b/CMake/CheckCxxTarget.cmake @@ -25,11 +25,12 @@ # SOFTWARE. +include(CheckCXXSourceCompiles) function(check_cxx_target var target code) check_cxx_source_compiles( " - __attribute__((target(\"${target}\"))) static int foo() { ${code} return 1; } - __attribute__((target(\"default\"))) static int foo() { ${code} return 0; } - int main() { return foo(); } + __attribute__((target(\"${target}\"))) static int foo(int i) { return ${code}; } + __attribute__((target(\"default\"))) static int foo(int i) { return i; } + int main(int i, char **) { return foo(i); } " ${var}) endfunction() -- cgit v1.2.3-18-g5258