使用 CMake 检测 BLAS/LAPACK 供应商
所以我的代码希望在不同的 BLAS/LAPACK 供应商发生时包含不同的头文件。是否有任何预定义的宏或类似的东西让我检查它?
So my code wants to include different header files when occurs to different BLAS/LAPACK vendors. Are there any predefined macros or something like that make me check it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CMake 2.8+ 附带 FindBLAS.cmake FindLAPACK.cmake。您可能需要查看本地 cmake 安装中的文件中的注释:cmake-2.8.5/share/cmake/Modules/FindBLAS.cmake。该模块支持各种 BLAS 和 LAPACK 实现。例如:
祝你好运。
CMake 2.8+ ships with FindBLAS.cmake FindLAPACK.cmake. You may want to review the comments in the files from your local cmake install: cmake-2.8.5/share/cmake/Modules/FindBLAS.cmake. This module supports a variety of BLAS and LAPACK implementations. For example:
Good luck.
(这是 CMake 3.x 时代的答案)
我曾经做过一个类似于其他答案的复杂工作流程,其中我尝试与不同的显式供应商一起检测 BLAS 发行版。
这样做的问题是你必须尝试很多可能性,逻辑就会变得复杂。
如果这是从命令行进行的,那么您还将覆盖供应商的选择。
因此,我现在要做的是检查输出变量并设置变量或采取任何特定操作:
(this is an answer for the CMake 3.x era)
I used to do a complicated workflow similar to the other answer, in which I tried with different explicit vendors to detect the BLAS distribution.
The problem with that is that you have to try many possibilities and the logic becomes complicated.
Also you are overriding the vendor choice if this was made from the command line.
So, what I do now is to inspect the output variables and set variables or take any specific action: