summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-04-28 11:18:07 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-04-28 11:18:41 (GMT)
commit73f81c5070e7880efe5acfc1827f60524116cee1 (patch)
treead84a9314fee3ce9917ae988eec1aef285a2d833 /Modules
parent4a0fbba1f28bccf9a072adc680325d8dba3b2a85 (diff)
parent4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa (diff)
downloadCMake-73f81c5070e7880efe5acfc1827f60524116cee1.zip
CMake-73f81c5070e7880efe5acfc1827f60524116cee1.tar.gz
CMake-73f81c5070e7880efe5acfc1827f60524116cee1.tar.bz2
Merge topic 'FindLAPACK-target'
4ed936d1b8 FindLAPACK: Provide the LAPACK::LAPACK import target Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4677
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindLAPACK.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index e5bd58d..e275946 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -47,6 +47,14 @@ The following variables may be set to influence this module's behavior:
``BLA_F95``
if ``ON`` tries to find the BLAS95/LAPACK95 interfaces
+Imported targets
+^^^^^^^^^^^^^^^^
+
+This module defines the following :prop_tgt:`IMPORTED` target:
+
+``LAPACK::LAPACK``
+ The libraries to use for LAPACK, if found.
+
Result Variables
^^^^^^^^^^^^^^^^
@@ -526,5 +534,22 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
set(LAPACK_LIBRARIES "")
endif()
+if(NOT TARGET LAPACK::LAPACK)
+ add_library(LAPACK::LAPACK INTERFACE IMPORTED)
+ set(_lapack_libs "${LAPACK_LIBRARIES}")
+ if(_lapack_libs AND TARGET BLAS::BLAS)
+ # remove the ${BLAS_LIBRARIES} from the interface and replace it
+ # with the BLAS::BLAS target
+ list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}")
+ endif()
+
+ if(_lapack_libs)
+ set_target_properties(LAPACK::LAPACK PROPERTIES
+ INTERFACE_LINK_LIBRARIES "${_lapack_libs}"
+ )
+ endif()
+ unset(_lapack_libs)
+endif()
+
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})