From 7377f1bc5a70c10d31f9c58338803848b450e1ec Mon Sep 17 00:00:00 2001 From: Zhuo Zhang Date: Mon, 25 Sep 2023 10:59:48 +0800 Subject: [PATCH] fix: disable -ffinite-math-only on x86 (#5051) --- src/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09f1b8ff48d5..ca7295b38134 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -341,11 +341,10 @@ else() set_target_properties(ncnn PROPERTIES POSITION_INDEPENDENT_CODE ON INTERFACE_POSITION_INDEPENDENT_CODE ON) endif() - if(CMAKE_BUILD_TYPE MATCHES "(Release|RELEASE|release)") + if(CMAKE_BUILD_TYPE MATCHES "(Release|RELEASE|release)" AND (NOT(NCNN_TARGET_ARCH STREQUAL "x86"))) if(NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.6)) target_compile_options(ncnn PRIVATE -Ofast) endif() - target_compile_options(ncnn PRIVATE -ffast-math) endif()