summaryrefslogtreecommitdiff
path: root/math/lapack/patches/patch-CMakeLists.txt
blob: 17c04a3406e9f875272de0a438da8352f6300406 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
$NetBSD: patch-CMakeLists.txt,v 1.3 2021/05/13 07:52:05 thor Exp $

Avoid installation of LAPACK CMake and pkg-config files when not installing
LAPACK, also allowing explicitly to switch off LAPACK build for BLAS-only
packaging.

--- CMakeLists.txt.orig	2021-03-25 18:25:15.000000000 +0000
+++ CMakeLists.txt
@@ -11,7 +11,7 @@ set(
   )
 
 # Add the CMake directory for custom CMake modules
-set(CMAKE_MODULE_PATH "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})
+set (CMAKE_MODULE_PATH "/data/pkgwork/math/lapack/work/.buildlink/cmake-Modules" "${LAPACK_SOURCE_DIR}/CMAKE" ${CMAKE_MODULE_PATH})
 
 # Export all symbols on Windows when building shared libraries
 SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
@@ -160,6 +160,9 @@ endif()
 
 
 # --------------------------------------------------
+
+if(LAPACK)
+
 set(LAPACK_INSTALL_EXPORT_NAME ${LAPACKLIB}-targets)
 
 macro(lapack_install_library lib)
@@ -171,6 +174,18 @@ macro(lapack_install_library lib)
   )
 endmacro()
 
+else()
+
+macro(lapack_install_library lib)
+  install(TARGETS ${lib}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
+    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT RuntimeLibraries
+  )
+endmacro()
+
+endif()
+
 set(PKG_CONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 
 # --------------------------------------------------
@@ -301,6 +316,10 @@ endif()
 
 option(USE_OPTIMIZED_LAPACK "Whether or not to use an optimized LAPACK library instead of included netlib LAPACK" OFF)
 
+option(LAPACK "Whether to build or use LAPACK (to enable a BLAS-only build)")
+
+if(LAPACK)
+
 # --------------------------------------------------
 # LAPACK
 # User did not provide a LAPACK Library but specified to search for one
@@ -342,6 +361,8 @@ else()
     CACHE STRING "Linker flags for shared libs" FORCE)
 endif()
 
+endif()
+
 if(BUILD_TESTING)
   add_subdirectory(TESTING)
 endif()
@@ -450,14 +471,18 @@ if(NOT BLAS_FOUND)
   set(ALL_TARGETS ${ALL_TARGETS} ${BLASLIB})
 endif()
 
+if(LAPACK)
 if(NOT LATESTLAPACK_FOUND)
   set(ALL_TARGETS ${ALL_TARGETS} ${LAPACKLIB})
+  set(BUILD_LAPACK ON)
+endif()
 endif()
 
 if(BUILD_TESTING OR LAPACKE_WITH_TMG)
   set(ALL_TARGETS ${ALL_TARGETS} ${TMGLIB})
 endif()
 
+if(LAPACK)
 # Export lapack targets, not including lapacke, from the
 # install tree, if any.
 set(_lapack_config_install_guard_target "")
@@ -471,6 +496,7 @@ if(ALL_TARGETS)
   # lapack-config.cmake to load targets from the install tree.
   list(GET ALL_TARGETS 0 _lapack_config_install_guard_target)
 endif()
+endif()
 
 # Include cblas in targets exported from the build tree.
 if(CBLAS)
@@ -482,6 +508,8 @@ if(LAPACKE)
   set(ALL_TARGETS ${ALL_TARGETS} ${LAPACKELIB})
 endif()
 
+if(BUILD_LAPACK)
+
 # Export lapack and lapacke targets from the build tree, if any.
 set(_lapack_config_build_guard_target "")
 if(ALL_TARGETS)
@@ -519,6 +547,9 @@ install(FILES
   DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LAPACKLIB}-${LAPACK_VERSION}
   COMPONENT Development
   )
+
+endif() # BUILD_LAPACK
+
 if (LAPACK++)
   install(
   DIRECTORY "${LAPACK_BINARY_DIR}/lib/"