Files
libsc/fix_zlib_linking.patch
Stefan Brüns c87fc43858 Accepting request 1136036 from home:StefanBruens:branches:science
- Update to version 2.8.5, no changelog provided
- Drop upstream patches:
  * remove_b64dec_enc.patch
- Add patches:
  * fix_zlib_linking.patch
  * fix_getopt_install.patch
  * fix_getopt_install2.patch

OBS-URL: https://build.opensuse.org/request/show/1136036
OBS-URL: https://build.opensuse.org/package/show/science/libsc?expand=0&rev=2
2024-01-03 02:02:48 +00:00

57 lines
1.6 KiB
Diff

From fad3a1ad9489ac482eb95b32fb48e48d94262cd0 Mon Sep 17 00:00:00 2001
From: Pierre Kestener <pierre.kestener@cea.fr>
Date: Thu, 20 Apr 2023 16:00:54 +0200
Subject: [PATCH] Cmake update to allow to chose if zlib is built or detected.
---
cmake/config.cmake | 14 ++++++++++++++
cmake/options.cmake | 3 ++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/cmake/config.cmake b/cmake/config.cmake
index d576f6d84..718d9f78b 100644
--- a/cmake/config.cmake
+++ b/cmake/config.cmake
@@ -9,12 +9,26 @@ include(CheckCSourceCompiles)
if(mpi)
find_package(MPI COMPONENTS C REQUIRED)
endif()
+
if(openmp)
find_package(OpenMP COMPONENTS C REQUIRED)
endif()
+
if(zlib)
+ message(STATUS "Using builtin zlib")
include(${CMAKE_CURRENT_LIST_DIR}/zlib.cmake)
+ set(SC_HAVE_ZLIB true)
+else()
+ find_package(ZLIB)
+ if(ZLIB_FOUND)
+ message(STATUS "Using system zlib : ${ZLIB_VERSION_STRING}")
+ set(SC_HAVE_ZLIB true)
+ else()
+ message(STATUS "Zlib disabled (not found). Consider using cmake \"-Dzlib=ON\" to turn on builtin zlib.")
+ set(SC_HAVE_ZLIB false)
+ endif()
endif()
+
find_package(Threads)
# --- set global compile environment
diff --git a/cmake/options.cmake b/cmake/options.cmake
index b4b9537fd..9be8620d9 100644
--- a/cmake/options.cmake
+++ b/cmake/options.cmake
@@ -1,8 +1,9 @@
+
include(GNUInstallDirs)
option(mpi "use MPI library" off)
option(openmp "use OpenMP" off)
-option(zlib "use ZLIB" on)
+option(zlib "build ZLIB" on)
option(BUILD_TESTING "build libsc self-tests" on)
option(BUILD_SHARED_LIBS "build shared libsc")