I am working on a project that uses Fortran and requires BLAS libraries. I’ve decided to use OpenBLAS, which I installed via Conan. However, I’m encountering an issue where CMake cannot find the BLAS libraries even though OpenBLAS is installed. Here’s my setup:
CMakeLists.txt:
cmake_minimum_required(VERSION 3.6.0)
project(test Fortran)
find_package(BLAS REQUIRED)
conanfile.txt:
[requires]
openblas/0.3.26
[generators]
CMakeDeps
CMakeToolchain
[layout]
cmake_layout
Build Script (batch file):
RMDIR /S /Q build
MKDIR build
CD build
SET "PATH=C:WindowsSystem32;C:Program FilesCMakebin;C:Users%USERNAME%AppDataRoamingPythonPython312Scripts;"
CALL "C:Program Files (x86)InteloneAPIsetvars.bat"
xcopy /s ..conanfile.txt conanfile.txt
conan install ..conanfile.txt --build=missing
cmake -G "Ninja" .. -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_BUILD_TYPE=Release
CD ..
When I run the batch script, CMake fails to configure the project with the following error:
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
I have confirmed that Conan successfully installed OpenBLAS. Why did CMake not find the BLAS libraries, and how can I resolve this issue?