diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2020-04-27 17:38:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-04-27 18:19:02 (GMT) |
commit | 4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa (patch) | |
tree | d20df507709fed0ff6245b8ff0bcd8a506334a13 /Modules/FindLAPACK.cmake | |
parent | 265fb71c917e3921012c2950a921cb380f60ae0f (diff) | |
download | CMake-4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa.zip CMake-4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa.tar.gz CMake-4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa.tar.bz2 |
FindLAPACK: Provide the LAPACK::LAPACK import target
Diffstat (limited to 'Modules/FindLAPACK.cmake')
-rw-r--r-- | Modules/FindLAPACK.cmake | 25 |
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}) |