File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,29 @@ if (CMAKE_CXX_COMPILER_ID IN_LIST GNU_LIKE_FRONTENDS)
2222 -ftree-vectorize
2323 -fimplicit-constexpr
2424 )
25- # Assuming FINUFFT_CXX_FLAGS_RELEASE is already defined
25+
26+ # Create a temporary list to hold the valid flags
27+ set (FINUFFT_CXX_FLAGS_RELEASE_VALID)
28+
29+ # Check each flag
2630 foreach (flag ${FINUFFT_CXX_FLAGS_RELEASE} )
27- check_cxx_compiler_flag("${flag} " flag_supported)
28- if (NOT flag_supported)
29- list (REMOVE_ITEM FINUFFT_CXX_FLAGS_RELEASE "${flag} " )
31+ string (FIND "${flag} " "=" EQUAL_SIGN_POS)
32+ if (EQUAL_SIGN_POS GREATER 0)
33+ string (SUBSTRING "${flag} " 0 ${EQUAL_SIGN_POS} BASE_FLAG)
34+ else ()
35+ set (BASE_FLAG ${flag} )
36+ endif ()
37+
38+ check_cxx_compiler_flag("${BASE_FLAG} " flag_supported)
39+ if (flag_supported)
40+ list (APPEND FINUFFT_CXX_FLAGS_RELEASE_VALID "${flag} " )
41+ else ()
3042 message (STATUS "Flag ${flag} is not supported by the compiler and will be removed." )
3143 endif ()
3244 endforeach ()
3345
46+ # Replace the original list with the valid flags list
47+ set (FINUFFT_CXX_FLAGS_RELEASE ${FINUFFT_CXX_FLAGS_RELEASE_VALID} )
3448 set (FINUFFT_CXX_FLAGS_RELWITHDEBINFO -g ${FINUFFT_CXX_FLAGS_RELEASE} )
3549endif ()
3650
You can’t perform that action at this time.
0 commit comments