2022-11-05 23:27:06 +01:00
|
|
|
#!-------------------------------------------------------------------------------------------------!
|
|
|
|
|
#! CP2K: A general program to perform molecular dynamics simulations !
|
2026-01-01 15:17:33 +01:00
|
|
|
#! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
|
2022-11-05 23:27:06 +01:00
|
|
|
#! !
|
|
|
|
|
#! SPDX-License-Identifier: GPL-2.0-or-later !
|
|
|
|
|
#!-------------------------------------------------------------------------------------------------!
|
2022-10-27 18:00:54 +02:00
|
|
|
|
|
|
|
|
# Copyright (c) 2022- ETH Zurich
|
|
|
|
|
#
|
|
|
|
|
# authors : Mathieu Taillefumier
|
|
|
|
|
|
|
|
|
|
if(NOT POLICY CMP0074)
|
|
|
|
|
set(_GenericBLAS_PATHS ${GenericBLAS_ROOT} $ENV{GenericBLAS_ROOT})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
find_library(
|
|
|
|
|
GenericBLAS_LIBRARIES
|
|
|
|
|
NAMES "blas"
|
|
|
|
|
HINTS ${_GenericBLAS_PATHS})
|
|
|
|
|
find_library(
|
|
|
|
|
# optinally look for cblas library - not required
|
|
|
|
|
GenericBLAS_CBLAS_LIBRARIES
|
|
|
|
|
NAMES "cblas"
|
|
|
|
|
HINTS ${_GenericBLAS_PATHS})
|
|
|
|
|
find_path(
|
|
|
|
|
GenericBLAS_INCLUDE_DIRS
|
|
|
|
|
NAMES "cblas.h"
|
|
|
|
|
HINTS ${_GenericBLAS_PATHS})
|
|
|
|
|
|
|
|
|
|
# check if found
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2023-01-18 10:55:50 +01:00
|
|
|
if(GenericBLAS_INCLUDE_DIRS)
|
|
|
|
|
find_package_handle_standard_args(
|
|
|
|
|
GenericBLAS REQUIRED_VARS GenericBLAS_INCLUDE_DIRS GenericBLAS_LIBRARIES)
|
|
|
|
|
else()
|
|
|
|
|
find_package_handle_standard_args(GenericBLAS
|
|
|
|
|
REQUIRED_VARS GenericBLAS_LIBRARIES)
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-10-27 18:00:54 +02:00
|
|
|
if(GenericBLAS_CBLAS_LIBRARIES)
|
|
|
|
|
list(APPEND GenericBLAS_LIBRARIES ${GenericBLAS_CBLAS_LIBRARIES})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# add target to link against
|
|
|
|
|
if(GenericBLAS_FOUND)
|
2023-02-10 13:38:55 +01:00
|
|
|
|
2023-09-29 11:14:42 +02:00
|
|
|
if(NOT TARGET cp2k::BLAS::GenericBLAS::blas)
|
|
|
|
|
add_library(cp2k::BLAS::GenericBLAS::blas INTERFACE IMPORTED)
|
2022-10-27 18:00:54 +02:00
|
|
|
endif()
|
2023-09-29 11:14:42 +02:00
|
|
|
set_property(TARGET cp2k::BLAS::GenericBLAS::blas
|
2023-02-10 13:38:55 +01:00
|
|
|
PROPERTY INTERFACE_LINK_LIBRARIES ${GenericBLAS_LIBRARIES})
|
2023-01-18 10:55:50 +01:00
|
|
|
set_property(
|
2023-09-29 11:14:42 +02:00
|
|
|
TARGET cp2k::BLAS::GenericBLAS::blas PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
2023-02-10 13:38:55 +01:00
|
|
|
${GenericBLAS_INCLUDE_DIRS})
|
2022-10-27 18:00:54 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# prevent clutter in cache
|
|
|
|
|
mark_as_advanced(GenericBLAS_FOUND GenericBLAS_LIBRARIES
|
|
|
|
|
GenericBLAS_INCLUDE_DIRS GenericBLAS_CBLAS_LIBRARIES)
|