summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-04-27 17:38:02 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-27 18:19:02 (GMT)
commit4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa (patch)
treed20df507709fed0ff6245b8ff0bcd8a506334a13 /Tests
parent265fb71c917e3921012c2950a921cb380f60ae0f (diff)
downloadCMake-4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa.zip
CMake-4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa.tar.gz
CMake-4ed936d1b8af6afc7dd88f3d6cad5c36e12f91aa.tar.bz2
FindLAPACK: Provide the LAPACK::LAPACK import target
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/FindLAPACK/CMakeLists.txt10
-rw-r--r--Tests/FindLAPACK/Test/CMakeLists.txt13
-rw-r--r--Tests/FindLAPACK/Test/main.c20
4 files changed, 44 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index ed472a1..5011863 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1434,6 +1434,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
ICU
JPEG
JsonCpp
+ LAPACK
LibArchive
LibLZMA
LibRHash
diff --git a/Tests/FindLAPACK/CMakeLists.txt b/Tests/FindLAPACK/CMakeLists.txt
new file mode 100644
index 0000000..2081d59
--- /dev/null
+++ b/Tests/FindLAPACK/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindLAPACK.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindLAPACK/Test"
+ "${CMake_BINARY_DIR}/Tests/FindLAPACK/Test"
+ ${build_generator_args}
+ --build-project TestFindLAPACK
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt
new file mode 100644
index 0000000..8afa36a
--- /dev/null
+++ b/Tests/FindLAPACK/Test/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 3.4)
+project(TestFindLAPACK C)
+include(CTest)
+
+find_package(LAPACK REQUIRED)
+
+add_executable(test_tgt main.c)
+target_link_libraries(test_tgt LAPACK::LAPACK)
+add_test(NAME test_tgt COMMAND test_tgt)
+
+add_executable(test_var main.c)
+target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES})
+add_test(NAME test_var COMMAND test_var)
diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c
new file mode 100644
index 0000000..5873e7b
--- /dev/null
+++ b/Tests/FindLAPACK/Test/main.c
@@ -0,0 +1,20 @@
+#include <assert.h>
+#include <string.h>
+
+// declare what parts of the lapack C-API we need
+void dgesv_(int*, int*, double*, int*, int*, double*, int*, int*);
+
+int main()
+{
+ double A[8] = {
+ 0, 1, 2, 3, 4, 5, 6, 7,
+ };
+ double B[2] = { 0, 5 };
+ int ipiv[2] = { 0, 0 };
+ int info = 0;
+
+ int dim = 2;
+ int numCols = 1;
+ dgesv_(&dim, &numCols, A, &dim, ipiv, B, &dim, &info);
+ return 0;
+}