Skip to content

Commit d2cc988

Browse files
committed
checking only constexpr
1 parent 904d602 commit d2cc988

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

CMakeLists.txt

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,13 @@ if (CMAKE_CXX_COMPILER_ID IN_LIST GNU_LIKE_FRONTENDS)
2020
-freciprocal-math
2121
-fmerge-all-constants
2222
-ftree-vectorize
23-
-fimplicit-constexpr
24-
)
2523

26-
# Create a temporary list to hold the valid flags
27-
set(FINUFFT_CXX_FLAGS_RELEASE_VALID)
28-
29-
# Check each flag
30-
foreach(flag ${FINUFFT_CXX_FLAGS_RELEASE})
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()
42-
message(STATUS "Flag ${flag} is not supported by the compiler and will be removed.")
43-
endif()
44-
endforeach()
45-
46-
# Replace the original list with the valid flags list
47-
set(FINUFFT_CXX_FLAGS_RELEASE ${FINUFFT_CXX_FLAGS_RELEASE_VALID})
24+
)
25+
# if -fimplicit-constexpr is supported, add it to the list of flags
26+
check_cxx_compiler_flag("-fimplicit-constexpr" COMPILER_SUPPORTS_FIMPLICIT_CONSTEXPR)
27+
if (COMPILER_SUPPORTS_FIMPLICIT_CONSTEXPR)
28+
list(APPEND FINUFFT_CXX_FLAGS_RELEASE -fimplicit-constexpr)
29+
endif ()
4830
set(FINUFFT_CXX_FLAGS_RELWITHDEBINFO -g ${FINUFFT_CXX_FLAGS_RELEASE})
4931
endif ()
5032

0 commit comments

Comments
 (0)