summaryrefslogtreecommitdiff
path: root/math/lapack/patches/patch-LAPACKE_CMakeLists.txt
blob: aedfafb553e46153cc09b39290251812a6150ac0 (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
35
36
37
38
39
40
41
42
43
44
45
$NetBSD: patch-LAPACKE_CMakeLists.txt,v 1.2 2021/05/12 14:32:51 thor Exp $

Support combined build of shared and static libraries.

--- LAPACKE/CMakeLists.txt.orig	2021-03-25 18:25:15.000000000 +0000
+++ LAPACKE/CMakeLists.txt
@@ -99,6 +99,25 @@ install(
   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
   COMPONENT Development
   )
+if(BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
+  add_library(${LAPACKELIB}_static STATIC ${SOURCES})
+  set_target_properties(
+    ${LAPACKELIB}_static PROPERTIES
+    LINKER_LANGUAGE C
+    OUTPUT_NAME ${LAPACKELIB}
+    )
+   target_include_directories(${LAPACKELIB}_static PUBLIC
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+    $<INSTALL_INTERFACE:include>
+  )
+
+  if(LAPACKE_WITH_TMG)
+    target_link_libraries(${LAPACKELIB}_static PRIVATE tmglib)
+  endif()
+  target_link_libraries(${LAPACKELIB}_static PRIVATE ${LAPACK_LIBRARIES})
+
+  lapack_install_library(${LAPACKELIB}_static)
+endif()
 
 if(BUILD_TESTING)
   add_subdirectory(example)
@@ -126,7 +145,8 @@ install(FILES
   COMPONENT Development
   )
 
-install(EXPORT ${LAPACKELIB}-targets
-  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKELIB}-${LAPACK_VERSION}
-  COMPONENT Development
-  )
+# What is broken here? CMake erros out with unknown lapacke-targets.
+#install(EXPORT ${LAPACKELIB}-targets
+#  DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKELIB}-${LAPACK_VERSION}
+#  COMPONENT Development
+#  )