From 3f7bd9c13e556602db856ae207d4d2f70ff8e304 Mon Sep 17 00:00:00 2001 From: Andrew Tribick Date: Sat, 8 Jan 2022 12:45:52 +0100 Subject: [PATCH] Update floating point compilation options --- cmake/FastMath.cmake | 2 +- src/celcompat/CMakeLists.txt | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/FastMath.cmake b/cmake/FastMath.cmake index fe7c1a395..127feacc5 100644 --- a/cmake/FastMath.cmake +++ b/cmake/FastMath.cmake @@ -6,6 +6,6 @@ function(EnableFastMath flag) if(MSVC) add_compile_options("/fp:fast") else() - add_compile_options("-ffast-math") + add_compile_options("-ffast-math -fno-finite-math-only") endif() endfunction() diff --git a/src/celcompat/CMakeLists.txt b/src/celcompat/CMakeLists.txt index d159c04a7..464adf475 100644 --- a/src/celcompat/CMakeLists.txt +++ b/src/celcompat/CMakeLists.txt @@ -1,10 +1,13 @@ -if (NOT HAVE_FLOAT_CHARCONV) +if(NOT HAVE_FLOAT_CHARCONV) set(CELCOMPAT_SOURCES charconv_impl.cpp charconv_impl.h ) endif() -if (CELCOMPAT_SOURCES) +if(CELCOMPAT_SOURCES) add_library(celcompat OBJECT ${CELCOMPAT_SOURCES}) + if(NOT MSVC) + target_compile_options(celcompat PRIVATE -fmath-errno) + endif() endif()