Reputation: 205
I found this CMake to find OpenBLAS but I can't find a way how to include that as an external file.
What I have in mind is like #include in C/C++. I tried googling bit i get the answer on how to include a project into CMake.
The main reason for this is that I want to have my CMake as clean and as small as possible since this is the fist time I am diving deeper in CMake world.
Upvotes: 0
Views: 651
Reputation: 5988
but I can't find a way how to include that as an external file.
You need:
Save the module (FindOpenBLAS.cmake
) inside your project, for example:
Project
└── cmake
└── Modules
└── FindOpenBLAS.cmake
Add the path into CMake variable inside CMakeLists.txt
:
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules/")
Add find_package
directive inside CMakeLists.txt
:
find_package (OpenBLAS REQUIRED)
Use populated variables, for example inside CMakeLists.txt
:
include_directories (${OpenBLAS_INCLUDE_DIR})
...
target_link_libraries (${OpenBLAS_LIB})
Upvotes: 3