summaryrefslogtreecommitdiff
path: root/math/lapack/patches/patch-CBLAS_src_CMakeLists.txt
blob: 2b1f63a69bdfb68335e5739db9e35fa3b212782d (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
32
33
34
$NetBSD: patch-CBLAS_src_CMakeLists.txt,v 1.4 2021/05/13 07:52:05 thor Exp $

- Support combined build of shared and static libraries.
- Link CBLAS with Fortran compiler to fix build on NetBSD.

--- CBLAS/src/CMakeLists.txt.orig	2021-03-25 18:25:15.000000000 +0000
+++ CBLAS/src/CMakeLists.txt
@@ -116,7 +116,6 @@ list(REMOVE_DUPLICATES SOURCES)
 add_library(${CBLASLIB} ${SOURCES})
 set_target_properties(
   ${CBLASLIB} PROPERTIES
-  LINKER_LANGUAGE C
   VERSION ${LAPACK_VERSION}
   SOVERSION ${LAPACK_MAJOR_VERSION}
   )
@@ -129,3 +128,18 @@ target_include_directories(${CBLASLIB} P
 )
 target_link_libraries(${CBLASLIB} PRIVATE ${BLAS_LIBRARIES})
 lapack_install_library(${CBLASLIB})
+
+if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
+  add_library(${CBLASLIB}_static STATIC ${SOURCES})
+  set_target_properties(
+    ${CBLASLIB}_static PROPERTIES
+    OUTPUT_NAME ${CBLASLIB}
+    )
+  target_include_directories(${CBLASLIB}_static PUBLIC
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+    $<INSTALL_INTERFACE:include>
+  )
+  target_link_libraries(${CBLASLIB}_static PRIVATE ${BLAS_LIBRARIES})
+  lapack_install_library(${CBLASLIB}_static)
+endif()
+