summaryrefslogtreecommitdiff
path: root/math/lapack/patches/patch-SRC_CMakeLists.txt
blob: 5d296fc385e1412f3b12030cb2a82fa5250318f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$NetBSD: patch-SRC_CMakeLists.txt,v 1.4 2022/03/13 07:31:56 nros Exp $

Support combined build of shared and static libraries.

--- SRC/CMakeLists.txt.orig	2021-06-28 16:39:12.000000000 +0000
+++ SRC/CMakeLists.txt
@@ -524,3 +524,24 @@ if(_is_coverage_build)
 endif()
 
 lapack_install_library(${LAPACKLIB})
+if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
+  add_library(${LAPACKLIB}_static STATIC ${SOURCES})
+  set_target_properties(
+    ${LAPACKLIB}_static PROPERTIES
+    OUTPUT_NAME ${LAPACKLIB}
+    Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${LAPACKLIB}_static_modules
+    )
+
+  if(USE_XBLAS)
+    target_link_libraries(${LAPACKLIB}_static PRIVATE ${XBLAS_LIBRARY})
+  endif()
+  target_link_libraries(${LAPACKLIB}_static PRIVATE ${BLAS_LIBRARIES})
+
+  if (_is_coverage_build)
+    target_link_libraries(${LAPACKLIB}_static PRIVATE gcov)
+    add_coverage(${LAPACKLIB}_static)
+  endif()
+
+  lapack_install_library(${LAPACKLIB}_static)
+endif()
+