From a29514bd2742c98ae3535d222f3c6a104938b243 Mon Sep 17 00:00:00 2001 From: Rory Yorke Date: Sun, 25 Jun 2023 12:38:31 +0200 Subject: [PATCH] Check if likely-to-be-used Numpy include directory is from virtual environment Addresses gh-193, in that the user gets an error. --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7b015c5..3cfa425f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,4 +22,18 @@ message(STATUS "F2PY headers included from: ${F2PY_INCLUDE_DIRS}") message(STATUS "LAPACK: ${LAPACK_LIBRARIES}") message(STATUS "BLAS: ${BLAS_LIBRARIES}") +# https://github.com/python-control/Slycot/issues/193 +if((EXISTS "${Python_INCLUDE_DIRS}/numpy") + AND (NOT ("${Python_INCLUDE_DIRS}/numpy" EQUAL "${Python_NumPy_INCLUDE_DIRS}"))) + + message(FATAL_ERROR + "Python include directory has a numpy sub-directory, + ${Python_INCLUDE_DIRS}/numpy, + which is different from Numpy include directory + ${Python_NumPy_INCLUDE_DIRS}. + You're probably building in a virtual environment, in which case + uninstall numpy from the base environment and try again.") + +endif() + add_subdirectory(slycot)