do not try to use Eigen's blas/lapack if they cannot be compiled
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a09a2ea..f2db304 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -314,10 +314,6 @@
   add_subdirectory(test EXCLUDE_FROM_ALL)
 endif()
 
-add_subdirectory(unsupported)
-
-add_subdirectory(demos EXCLUDE_FROM_ALL)
-
 if(NOT MSVC)
   if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)
     add_subdirectory(blas)
@@ -328,6 +324,10 @@
   endif()
 endif(NOT MSVC)
 
+add_subdirectory(unsupported)
+
+add_subdirectory(demos EXCLUDE_FROM_ALL)
+
 # must be after test and unsupported, for configuring buildtests.in
 add_subdirectory(scripts EXCLUDE_FROM_ALL)
 
diff --git a/unsupported/test/CMakeLists.txt b/unsupported/test/CMakeLists.txt
index 854a41e..d3ed2b5 100644
--- a/unsupported/test/CMakeLists.txt
+++ b/unsupported/test/CMakeLists.txt
@@ -3,35 +3,45 @@
 
 set(SPARSE_LIBS "")
 
+# configure blas/lapack
+if(CMAKE_Fortran_COMPILER_WORKS)
+  set(BLAS_FOUND TRUE)
+  set(LAPACK_FOUND TRUE)
+  set(BLAS_LIBRARIES eigen_blas_static)
+  set(LAPACK_LIBRARIES eigen_lapack_static)
+else()
+  # TODO search for default blas/lapack
+endif()
+
 find_package(Cholmod)
-if(CHOLMOD_FOUND)
+if(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND)
   add_definitions("-DEIGEN_CHOLMOD_SUPPORT")
   include_directories(${CHOLMOD_INCLUDES})
-  set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} eigen_blas_static eigen_lapack_static)
+  set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})
   ei_add_property(EIGEN_TESTED_BACKENDS "Cholmod, ")
-else(CHOLMOD_FOUND)
+else()
   ei_add_property(EIGEN_MISSING_BACKENDS "Cholmod, ")
-endif(CHOLMOD_FOUND)
+endif()
 
 find_package(Umfpack)
-if(UMFPACK_FOUND)
+if(UMFPACK_FOUND AND BLAS_FOUND)
   add_definitions("-DEIGEN_UMFPACK_SUPPORT")
   include_directories(${UMFPACK_INCLUDES})
-  set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} eigen_blas_static)
+  set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})
   ei_add_property(EIGEN_TESTED_BACKENDS "UmfPack, ")
-else(UMFPACK_FOUND)
+else()
   ei_add_property(EIGEN_MISSING_BACKENDS "UmfPack, ")
-endif(UMFPACK_FOUND)
+endif()
 
 find_package(SuperLU)
-if(SUPERLU_FOUND)
+if(SUPERLU_FOUND AND BLAS_FOUND)
   add_definitions("-DEIGEN_SUPERLU_SUPPORT")
   include_directories(${SUPERLU_INCLUDES})
-  set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} eigen_blas_static)
+  set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})
   ei_add_property(EIGEN_TESTED_BACKENDS  "SuperLU, ")
-else(SUPERLU_FOUND)
+else()
   ei_add_property(EIGEN_MISSING_BACKENDS  "SuperLU, ")
-endif(SUPERLU_FOUND)
+endif()
 
 find_package(GoogleHash)
 if(GOOGLEHASH_FOUND)