diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 63992b98039af3677f6b57ebc897cdd955073a39..a91df200719c58509e464fe416bea63845e16c2b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -77,6 +77,18 @@ if ("${BUILD_LIB}" STREQUAL "yes")
         set(GFORT gfortran)
     endif()
 
+    if(NOT OpenBLAS_LIBRARIES)
+        set(OpenBLAS_LIBRARIES "")
+    endif()
+
+    if(NOT BLAS_LIBRARIES)
+        set(BLAS_LIBRARIES "")
+    endif()
+
+    if(NOT LAPACK_LIBRARIES)
+        set(LAPACK_LIBRARIES "")
+    endif()
+
     target_link_libraries(
         lib4neuro