cmake: Convert check_cxx_source_compiles_with_flags to a function

This commit is contained in:
Hennadii Stepanov
2025-02-20 12:39:03 +00:00
parent 88ee6800c9
commit 71bf8294a9
5 changed files with 48 additions and 16 deletions

View File

@@ -2,13 +2,15 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
include(CheckSourceCompilesAndLinks)
# Check for clmul instructions support.
if(MSVC)
set(CLMUL_CXXFLAGS)
set(CLMUL_CXXFLAGS "")
else()
set(CLMUL_CXXFLAGS -mpclmul)
endif()
check_cxx_source_compiles_with_flags("${CLMUL_CXXFLAGS}" "
check_cxx_source_compiles_with_flags("
#include <immintrin.h>
#include <cstdint>
@@ -22,6 +24,7 @@ check_cxx_source_compiles_with_flags("${CLMUL_CXXFLAGS}" "
return e == 0;
}
" HAVE_CLMUL
CXXFLAGS ${CLMUL_CXXFLAGS}
)
add_library(minisketch_common INTERFACE)