summaryrefslogtreecommitdiffstats
path: root/Tests/FindBLAS
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-04-23 15:17:48 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-04-23 17:59:33 (GMT)
commit85a9813a764f7f451e1bf8422eafc5e5448e959b (patch)
tree49d8792a069e49af0e97630aea5c92938ca0b7a1 /Tests/FindBLAS
parent5e70315fa89ceb99a6165620c53de25944d47cdf (diff)
downloadCMake-85a9813a764f7f451e1bf8422eafc5e5448e959b.zip
CMake-85a9813a764f7f451e1bf8422eafc5e5448e959b.tar.gz
CMake-85a9813a764f7f451e1bf8422eafc5e5448e959b.tar.bz2
BLAS: Provide the BLAS::BLAS import target
Diffstat (limited to 'Tests/FindBLAS')
-rw-r--r--Tests/FindBLAS/CMakeLists.txt10
-rw-r--r--Tests/FindBLAS/Test/CMakeLists.txt13
-rw-r--r--Tests/FindBLAS/Test/main.c14
3 files changed, 37 insertions, 0 deletions
diff --git a/Tests/FindBLAS/CMakeLists.txt b/Tests/FindBLAS/CMakeLists.txt
new file mode 100644
index 0000000..667195d
--- /dev/null
+++ b/Tests/FindBLAS/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindBLAS.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindBLAS/Test"
+ "${CMake_BINARY_DIR}/Tests/FindBLAS/Test"
+ ${build_generator_args}
+ --build-project TestFindBLAS
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindBLAS/Test/CMakeLists.txt b/Tests/FindBLAS/Test/CMakeLists.txt
new file mode 100644
index 0000000..59418f3
--- /dev/null
+++ b/Tests/FindBLAS/Test/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindBLAS C)
+include(CTest)
+
+find_package(BLAS REQUIRED)
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt BLAS::BLAS)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_link_libraries(test_var PRIVATE ${BLAS_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindBLAS/Test/main.c b/Tests/FindBLAS/Test/main.c
new file mode 100644
index 0000000..7360dee
--- /dev/null
+++ b/Tests/FindBLAS/Test/main.c
@@ -0,0 +1,14 @@
+#include <assert.h>
+#include <string.h>
+
+// declare what parts of the blas C-API we need
+void cblas_dswap(const int N, double* X, const int incX, double* Y,
+ const int incY);
+
+int main()
+{
+ double x[4] = { 1, 2, 3, 4 };
+ double y[4] = { 8, 7, 7, 6 };
+ cblas_dswap(4, x, 1, y, 1);
+ return 0;
+}