From ebf5eeffb12d75ad8499d03102aab056958ee10d Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 28 Mar 2024 09:46:58 +0100 Subject: [PATCH] Fix cmake: `cannot create directory: /cmake/Amici` (#2389) Fixes cmake-install failures during model import in cases where BLAS was not found via FindBLAS. Needs a prettier solution at some point, but it does the job for now. --- cmake/AmiciFindBLAS.cmake | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cmake/AmiciFindBLAS.cmake b/cmake/AmiciFindBLAS.cmake index 6b2f9cf5f9..51d9c9b257 100644 --- a/cmake/AmiciFindBLAS.cmake +++ b/cmake/AmiciFindBLAS.cmake @@ -83,13 +83,14 @@ if(NOT TARGET BLAS::BLAS) INTERFACE_INCLUDE_DIRECTORIES "${BLAS_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}") add_library(BLAS::BLAS ALIAS BLAS) - install(TARGETS BLAS EXPORT BLAS) - export(EXPORT BLAS NAMESPACE BLAS::) - install( - EXPORT BLAS - DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Amici" - NAMESPACE BLAS::) - + if("${PROJECT_NAME}" STREQUAL "amici") + install(TARGETS BLAS EXPORT BLAS) + export(EXPORT BLAS NAMESPACE BLAS::) + install( + EXPORT BLAS + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Amici" + NAMESPACE BLAS::) + endif() # legacy python package environment variables: if(DEFINED ENV{BLAS_CFLAGS})