File fix_math_check.patch of Package zfp
From 6d7d2424ed082eb41d696036b26831636650a614 Mon Sep 17 00:00:00 2001
From: lindstro <pl@llnl.gov>
Date: Wed, 10 Aug 2022 13:35:59 -0700
Subject: [PATCH] Prevent LTO in libm dependency check (resolves #169)
---
CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2d0615aca..27d21f810 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -257,10 +257,10 @@ list(APPEND ppm_private_defs PPM_CHROMA=${PPM_CHROMA})
# Link libm only if necessary
include(CheckCSourceCompiles)
-check_c_source_compiles("#include<math.h>\nfloat f; int main(){sqrt(f);return 0;}" HAVE_MATH)
+check_c_source_compiles("#include<math.h>\nint main(int n,char*v[]){return sqrt(n);}" HAVE_MATH)
if(NOT HAVE_MATH)
set(CMAKE_REQUIRED_LIBRARIES m)
- check_c_source_compiles("#include<math.h>\nfloat f; int main(){sqrt(f);return 0;}" HAVE_LIBM_MATH)
+ check_c_source_compiles("#include<math.h>\nint main(int n,char*v[]){return sqrt(n);}" HAVE_LIBM_MATH)
unset(CMAKE_REQUIRED_LIBRARIES)
if(NOT HAVE_LIBM_MATH)
message(FATAL_ERROR "Unable to use C math library functions (with or without -lm)")