From 59ae7eaabc7b3ad31ba6ea33f0158731ee163c0f Mon Sep 17 00:00:00 2001 From: jonathonl Date: Fri, 2 Apr 2021 16:59:43 -0400 Subject: [PATCH 1/2] Moves target_link_libraries() and target_compile_features() from cmake config to lists file and adds find_package() for BLAS and LAPACK. --- CMakeLists.txt | 5 +++++ xtensor-blasConfig.cmake.in | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66aa721..cebfaf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,11 @@ target_include_directories(xtensor-blas $ $) +find_package(BLAS REQUIRED) +find_package(LAPACK REQUIRED) +target_link_libraries(xtensor-blas INTERFACE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) +target_compile_features(xtensor-blas INTERFACE cxx_std_14) + OPTION(CXXBLAS_DEBUG "print cxxblas debug information" OFF) OPTION(XTENSOR_USE_FLENS_BLAS "use FLENS generic implementation instead of cblas" OFF) # Decide whether to use OpenBLAS or not. diff --git a/xtensor-blasConfig.cmake.in b/xtensor-blasConfig.cmake.in index f700e55..bcfb456 100644 --- a/xtensor-blasConfig.cmake.in +++ b/xtensor-blasConfig.cmake.in @@ -22,10 +22,6 @@ if(NOT TARGET @PROJECT_NAME@) get_target_property(@PROJECT_NAME@_INCLUDE_DIRS xtensor-blas INTERFACE_INCLUDE_DIRECTORIES) find_dependency(BLAS REQUIRED) find_dependency(LAPACK REQUIRED) - target_link_libraries(xtensor-blas INTERFACE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) - if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.8) - target_compile_features(xtensor-blas INTERFACE cxx_std_14) - endif() endif() set(PN xtensor_blas) From deb902fc04d2f36949a13204e04f326ee1f25bcc Mon Sep 17 00:00:00 2001 From: jonathonl Date: Sat, 3 Apr 2021 09:46:00 -0400 Subject: [PATCH 2/2] Removes target_link_libraries() from CMakeLists.txt in favor of setting INTERFACE_LINK_LIBRARIES in config. --- CMakeLists.txt | 3 --- xtensor-blasConfig.cmake.in | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cebfaf5..1584b6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,9 +77,6 @@ target_include_directories(xtensor-blas $ $) -find_package(BLAS REQUIRED) -find_package(LAPACK REQUIRED) -target_link_libraries(xtensor-blas INTERFACE ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) target_compile_features(xtensor-blas INTERFACE cxx_std_14) OPTION(CXXBLAS_DEBUG "print cxxblas debug information" OFF) diff --git a/xtensor-blasConfig.cmake.in b/xtensor-blasConfig.cmake.in index bcfb456..6b4c2ff 100644 --- a/xtensor-blasConfig.cmake.in +++ b/xtensor-blasConfig.cmake.in @@ -22,6 +22,9 @@ if(NOT TARGET @PROJECT_NAME@) get_target_property(@PROJECT_NAME@_INCLUDE_DIRS xtensor-blas INTERFACE_INCLUDE_DIRECTORIES) find_dependency(BLAS REQUIRED) find_dependency(LAPACK REQUIRED) + set_target_properties(xtensor-blas PROPERTIES + INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES};${LAPACK_LIBRARIES}" + ) endif() set(PN xtensor_blas)