cmake CheckSymbolExists 用于内部
cmake CheckSymbolExists for intrinsic
我想使用 cmake 检查英特尔内部函数,例如 _mm_popcnt_u32
或 _mm_blendv_epi8
。但是函数 check_symbol_exists
不能正常工作取决于编译器。 (它适用于 Clang 但不适用于 GCC)。确实有记录
If the header files declare the symbol as a function or variable then the symbol must also be available for linking (so intrinsics may not be detected).
有没有简单的方法来检查这些?
正如 CMake 文档中所述:
If the symbol is a type, enum value, or intrinsic it will not be
recognized (consider using CheckTypeSize
or CheckCSourceCompiles
).
因此,尝试使用 CheckCSourceCompiles
编译一个带有 Intel 内在函数的小示例。例如:
include(CheckCSourceCompiles)
check_c_source_compiles("
int main() {
int tmp = _mm_popcnt_u32(0);
return 0;
}
"
HAVE_INTRINISC
)
我想使用 cmake 检查英特尔内部函数,例如 _mm_popcnt_u32
或 _mm_blendv_epi8
。但是函数 check_symbol_exists
不能正常工作取决于编译器。 (它适用于 Clang 但不适用于 GCC)。确实有记录
If the header files declare the symbol as a function or variable then the symbol must also be available for linking (so intrinsics may not be detected).
有没有简单的方法来检查这些?
正如 CMake 文档中所述:
If the symbol is a type, enum value, or intrinsic it will not be recognized (consider using
CheckTypeSize
orCheckCSourceCompiles
).
因此,尝试使用 CheckCSourceCompiles
编译一个带有 Intel 内在函数的小示例。例如:
include(CheckCSourceCompiles)
check_c_source_compiles("
int main() {
int tmp = _mm_popcnt_u32(0);
return 0;
}
"
HAVE_INTRINISC
)