OpenBLAS
OpenBLAS copied to clipboard
CMake find module in pre-built distribution
I can see here that there is a template for a well made find module for OpenBLAS. However, the find module provided with the pre-built releases is extremely basic and doesn't work without modification.
Where does the nicer find module get used? Is there a reason not to include it with the download?
The .cmake.in gets serves as a template during the install step to create the .cmake module. Which release did you look at ? I think there used to be a problem where the Makefile and CMake builds did not create the same "nice" quality module.
I am using the 0.3.25-x64 release for Windows. The contents of OpenBLASConfig.cmake are:
SET(OpenBLAS_VERSION "0.3.25")
SET(OpenBLAS_INCLUDE_DIRS win64/include)
SET(OpenBLAS_LIBRARIES win64/bin/libopenblas.dll)
which doesn't work without some changes.
Sorry, I really do not know how to improve this - the precompiled binaries are provided as a convenience for anybody who cannot build their own, and I have no idea where they would end up on a user's system. The paths you saw simply correspond to the (relative) install locations on my build host - which currently happens to be a Linux system with a mingw(gcc)-based cross-compiler
Here is what I am using which I think would be an improvement.
SET(OpenBLAS_VERSION "0.3.25")
file(REAL_PATH "../../.." _OpenBLAS_ROOT_DIR BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} )
SET(OpenBLAS_INCLUDE_DIRS ${_OpenBLAS_ROOT_DIR}/include)
SET(OpenBLAS_LIBRARIES ${_OpenBLAS_ROOT_DIR}/bin/libopenblas.dll)
add_library(OpenBLAS::OpenBLAS SHARED IMPORTED)
target_include_directories(OpenBLAS::OpenBLAS INTERFACE ${OpenBLAS_INCLUDE_DIRS})
set_property(TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_LOCATION ${OpenBLAS_LIBRARIES})
set_property(TARGET OpenBLAS::OpenBLAS PROPERTY IMPORTED_IMPLIB ${_OpenBLAS_ROOT_DIR}/lib/libopenblas.lib)
The user just needs to set an OpenBLAS_DIR cache variable that points to the location of the find module. The find module will provide the same OpenBLAS::OpenBLAS target that you gen when building from source or using VCPKG.