From 810a75030676054ac6512ea5c06a9e79e3bd5330 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Wed, 26 Feb 2025 12:18:16 +0100 Subject: [PATCH 1/2] fix /permissive- flag casuing a compile error on clang for windows --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08b417a8..fb23f854 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,10 @@ if(FASTFLOAT_SANITIZE) endif() endif() if(MSVC_VERSION GREATER 1910) - target_compile_options(fast_float INTERFACE /permissive-) + # /permissive- will only work on MSVC or clang-cl, clang will not accept it. + if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") + target_compile_options(fast_float INTERFACE /permissive-) + endif() endif() From b7b17e6cac5ba03408293a3b9b03eacb918422e8 Mon Sep 17 00:00:00 2001 From: dankmeme01 <42031238+dankmeme01@users.noreply.github.com> Date: Wed, 26 Feb 2025 14:49:12 +0100 Subject: [PATCH 2/2] improve check for /permissive- flag --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb23f854..1fd257eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,13 +55,14 @@ if(FASTFLOAT_SANITIZE) target_link_libraries(fast_float INTERFACE -fuse-ld=gold) endif() endif() -if(MSVC_VERSION GREATER 1910) - # /permissive- will only work on MSVC or clang-cl, clang will not accept it. - if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") - target_compile_options(fast_float INTERFACE /permissive-) - endif() -endif() +include(CheckCXXCompilerFlag) +unset(FASTFLOAT_COMPILER_SUPPORTS_PERMISSIVE) +CHECK_CXX_COMPILER_FLAG(/permissive- FASTFLOAT_COMPILER_SUPPORTS_PERMISSIVE) + +if(FASTFLOAT_COMPILER_SUPPORTS_PERMISSIVE) + target_compile_options(fast_float INTERFACE /permissive-) +endif() if(FASTFLOAT_INSTALL) include(CMakePackageConfigHelpers)