使用CMake-GUI 3.10.1+MinGW配置项目时BLAS检测失败求助
I get it—you expected CMake-GUI to automatically pick up BLAS for your project, but that error in FindBLAS.cmake is throwing a wrench in things. Let’s work through how to fix this with your setup (CMake-GUI 3.10.1 + MinGW 7.2.0).
The root problem here is that CMake can’t locate a BLAS implementation on your system—either it’s not installed, or it’s in a directory CMake doesn’t check by default. Here’s what you can do to resolve it:
1. Install a MinGW-Compatible BLAS Library
First, you need a BLAS library that works with MinGW. OpenBLAS is a great choice here, and it’s easy to set up:
- Using MinGW Package Manager: If you have
mingw-getinstalled, open your MinGW terminal and run:mingw-get install mingw32-openblas - Building from Source: If the package manager doesn’t have the version you need, grab the OpenBLAS source code, then compile it using your MinGW tools (follow the official build guide for Windows/MinGW).
2. Manually Point CMake to BLAS
If auto-detection still doesn’t work after installation, you can explicitly tell CMake where to find BLAS in the GUI:
- Open CMake-GUI, load your project, and click the "Add Entry" button.
- Create two new variables (replace the paths with your actual OpenBLAS installation directory):
BLAS_INCLUDE_DIRS: Set this to the folder containingcblas.h(e.g.,C:/mingw32/include/openblas)BLAS_LIBRARIES: Set this to the path of the BLAS library file (e.g.,C:/mingw32/lib/libopenblas.a)
- Click "Configure" again—CMake should now recognize the BLAS library.
3. Upgrade CMake (Optional)
CMake 3.10 is pretty outdated (it’s from 2017). Newer CMake versions have much better auto-detection logic for BLAS on Windows with MinGW. If you’re not tied to 3.10.1, upgrading to a newer version (like 3.20 or later) might fix the auto-detection issue without needing manual setup.
Also, double-check that your MinGW bin directory is added to your system’s PATH environment variable—this helps CMake find all your MinGW tools and libraries smoothly.
Content of the question originates from Stack Exchange, question author Taylor Johnson

