Skip to content

Commit d2f26a2

Browse files
committed
checking supported flags at compile time
1 parent c89ebd4 commit d2f26a2

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@ if (CMAKE_CXX_COMPILER_ID IN_LIST GNU_LIKE_FRONTENDS)
2020
-freciprocal-math
2121
-fmerge-all-constants
2222
-ftree-vectorize
23+
-fimplicit-constexpr
2324
)
24-
# if the compiler does support -fimplicit-constexpr add it
25-
check_cxx_compiler_flag("-fimplicit-constexpr" COMPILER_SUPPORTS_FIMPLICIT_CONSTEXPR)
26-
if (COMPILER_SUPPORTS_FIMPLICIT_CONSTEXPR)
27-
list(APPEND FINUFFT_CXX_FLAGS_RELEASE -fimplicit-constexpr)
28-
endif ()
25+
# Assuming FINUFFT_CXX_FLAGS_RELEASE is already defined
26+
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}")
30+
message(STATUS "Flag ${flag} is not supported by the compiler and will be removed.")
31+
endif()
32+
endforeach()
33+
2934
set(FINUFFT_CXX_FLAGS_RELWITHDEBINFO -g ${FINUFFT_CXX_FLAGS_RELEASE})
3035
endif ()
3136

0 commit comments

Comments
 (0)