aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/dlib/fix-lapack.patch
blob: 6643c0908a84dc65a71dea984b4d7df364619320 (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
diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt
index 5a3135b3b8..0ce2996f9a 100644
--- a/dlib/CMakeLists.txt
+++ b/dlib/CMakeLists.txt
@@ -612,18 +612,10 @@ if (NOT TARGET dlib)
          # Try to find BLAS, LAPACK and MKL
          include(cmake_utils/find_blas.cmake)
 
-         if (DLIB_USE_BLAS)
-            if (blas_found)
-               list (APPEND dlib_needed_public_libraries ${blas_libraries})
-            else()
-               set(DLIB_USE_BLAS OFF CACHE STRING ${DLIB_USE_BLAS_STR} FORCE )
-               toggle_preprocessor_switch(DLIB_USE_BLAS)
-            endif()
-         endif()
-
          if (DLIB_USE_LAPACK)
             if (lapack_found)
                list (APPEND dlib_needed_public_libraries ${lapack_libraries})
+               string(APPEND pkg_config_dlib_requires_private " lapack")
                if (lapack_with_underscore)
                   set(LAPACK_FORCE_UNDERSCORE 1)
                   enable_preprocessor_switch(LAPACK_FORCE_UNDERSCORE)
@@ -637,6 +629,16 @@ if (NOT TARGET dlib)
             endif()
          endif()
 
+         if (DLIB_USE_BLAS)
+            if (blas_found)
+               list (APPEND dlib_needed_public_libraries ${blas_libraries})
+               string(APPEND pkg_config_dlib_requires_private " blas")
+            else()
+               set(DLIB_USE_BLAS OFF CACHE STRING ${DLIB_USE_BLAS_STR} FORCE )
+               toggle_preprocessor_switch(DLIB_USE_BLAS)
+            endif()
+         endif()
+
          if (DLIB_USE_MKL_FFT)
             if (found_intel_mkl AND found_intel_mkl_headers)
                list (APPEND dlib_needed_public_includes ${mkl_include_dir})
diff --git a/dlib/cmake_utils/dlibConfig.cmake.in b/dlib/cmake_utils/dlibConfig.cmake.in
index cc7b4a21d7..918707a418 100644
--- a/dlib/cmake_utils/dlibConfig.cmake.in
+++ b/dlib/cmake_utils/dlibConfig.cmake.in
@@ -38,6 +38,8 @@ endif()
 if("@DLIB_LINK_WITH_SQLITE3@")
    find_dependency(unofficial-sqlite3 CONFIG)
 endif()
+find_dependency(BLAS)
+find_dependency(LAPACK)
 
 set(dlib_LIBRARIES dlib::dlib)
 set(dlib_LIBS      dlib::dlib)
diff --git a/dlib/cmake_utils/find_blas.cmake b/dlib/cmake_utils/find_blas.cmake
index 21edbdbe42..92858951d8 100644
--- a/dlib/cmake_utils/find_blas.cmake
+++ b/dlib/cmake_utils/find_blas.cmake
@@ -32,7 +32,7 @@ SET(lapack_without_underscore 0)
 message(STATUS "Searching for BLAS and LAPACK")
 INCLUDE(CheckFunctionExists)
 
-if (UNIX OR MINGW)
+if (0)
    message(STATUS "Searching for BLAS and LAPACK")
 
    if (BUILDING_MATLAB_MEX_FILE)
@@ -296,7 +296,7 @@ if (UNIX OR MINGW)
 
 
 
-elseif(WIN32 AND NOT MINGW)
+elseif(0)
    message(STATUS "Searching for BLAS and LAPACK")
 
    include(CheckTypeSize)
@@ -435,19 +435,18 @@ endif()
 if (NOT blas_found)
    find_package(BLAS QUIET)
    if (${BLAS_FOUND})
-      set(blas_libraries ${BLAS_LIBRARIES})      
+      set(blas_libraries BLAS::BLAS)
       set(blas_found 1)
       if (NOT lapack_found)
          find_package(LAPACK QUIET)
          if (${LAPACK_FOUND})
-            set(lapack_libraries ${LAPACK_LIBRARIES})
+            set(lapack_libraries LAPACK::LAPACK)
             set(lapack_found 1)
          endif()
       endif()
    endif()
 endif()
 
-
 # If using lapack, determine whether to mangle functions
 if (lapack_found)
    include(CheckFortranFunctionExists)