Skip to content

Commit

Permalink
checking supported flags at compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamonDinoia committed Jul 3, 2024
1 parent c89ebd4 commit d2f26a2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ if (CMAKE_CXX_COMPILER_ID IN_LIST GNU_LIKE_FRONTENDS)
-freciprocal-math
-fmerge-all-constants
-ftree-vectorize
-fimplicit-constexpr
)
# if the compiler does support -fimplicit-constexpr add it
check_cxx_compiler_flag("-fimplicit-constexpr" COMPILER_SUPPORTS_FIMPLICIT_CONSTEXPR)
if (COMPILER_SUPPORTS_FIMPLICIT_CONSTEXPR)
list(APPEND FINUFFT_CXX_FLAGS_RELEASE -fimplicit-constexpr)
endif ()
# Assuming FINUFFT_CXX_FLAGS_RELEASE is already defined
foreach(flag ${FINUFFT_CXX_FLAGS_RELEASE})
check_cxx_compiler_flag("${flag}" flag_supported)
if(NOT flag_supported)
list(REMOVE_ITEM FINUFFT_CXX_FLAGS_RELEASE "${flag}")
message(STATUS "Flag ${flag} is not supported by the compiler and will be removed.")
endif()
endforeach()

set(FINUFFT_CXX_FLAGS_RELWITHDEBINFO -g ${FINUFFT_CXX_FLAGS_RELEASE})
endif ()

Expand Down

0 comments on commit d2f26a2

Please sign in to comment.