I have a project (that uses pre-compiled headers) that uses different compiler options for SOME files.
For those files I have this is in my CMakelists.txt:
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
set_source_files_properties(${AVX_Files}
PROPERTIES
COMPILE_OPTIONS "-mavx;-mavx2;-mfma;-mssse3;-msse4.2")
set_source_files_properties(avx_simd_check.cpp
PROPERTIES
COMPILE_OPTIONS "-mxsave")
endif()
When I build for ARM, it all works :)
When I try to build for X86_64, I get the following error for avx_simd_check.cpp:
error: current translation unit is compiled with the target feature '+xsave' but the AST file was not
1 error generated.
and for all the other files in question:
error: current translation unit is compiled with the target feature '+avx' but the AST file was not
error: current translation unit is compiled with the target feature '+avx2' but the AST file was not
error: current translation unit is compiled with the target feature '+fma' but the AST file was not
error: current translation unit is compiled with the target feature '+sse4.2' but the AST file was not
error: current translation unit is compiled with the target feature '+ssse3' but the AST file was not
5 errors generated.
How can I solve this please? David