Skip to content

Commit b7b17e6

Browse files
committed
improve check for /permissive- flag
1 parent 810a750 commit b7b17e6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

CMakeLists.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ if(FASTFLOAT_SANITIZE)
5555
target_link_libraries(fast_float INTERFACE -fuse-ld=gold)
5656
endif()
5757
endif()
58-
if(MSVC_VERSION GREATER 1910)
59-
# /permissive- will only work on MSVC or clang-cl, clang will not accept it.
60-
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
61-
target_compile_options(fast_float INTERFACE /permissive-)
62-
endif()
63-
endif()
6458

59+
include(CheckCXXCompilerFlag)
60+
unset(FASTFLOAT_COMPILER_SUPPORTS_PERMISSIVE)
61+
CHECK_CXX_COMPILER_FLAG(/permissive- FASTFLOAT_COMPILER_SUPPORTS_PERMISSIVE)
62+
63+
if(FASTFLOAT_COMPILER_SUPPORTS_PERMISSIVE)
64+
target_compile_options(fast_float INTERFACE /permissive-)
65+
endif()
6566

6667
if(FASTFLOAT_INSTALL)
6768
include(CMakePackageConfigHelpers)

0 commit comments

Comments
 (0)