File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -116,8 +116,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID
116116 elseif (DETECTED_AVX_10)
117117 SET (AVX_FLAGS "${AVX_FLAGS} -mavx" )
118118 endif ()
119- # TODO: Check for AVX512 support
120- SET (AVX_FLAGS "${AVX_FLAGS} -mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd" )
119+ # Only add -mno-avx512* if the compiler accepts them
120+ foreach (flag -mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd)
121+ string (REPLACE "-" "_" safe_flag ${flag} )
122+ check_cxx_compiler_flag("${flag} " HAS_FLAG_${safe_flag} )
123+ if (HAS_FLAG_${safe_flag} )
124+ set (AVX_FLAGS "${AVX_FLAGS} ${flag} " )
125+ endif ()
126+ endforeach ()
121127elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
122128 set (AVX_FLAGS "-xHost" )
123129elseif (MSVC )
You can’t perform that action at this time.
0 commit comments