summaryrefslogtreecommitdiff
path: root/Tests/FindLAPACK
diff options
context:
space:
mode:
authorIgor S. Gerasimov <i.s.ger@ya.ru>2021-09-04 11:35:22 +0900
committerIgor S. Gerasimov <i.s.ger@ya.ru>2021-10-05 23:41:36 +0900
commit972489ae4e22179028b5e3ed8f908100665a368d (patch)
treef1f14f734c722b04be20c82c35e011e8c8d1df70 /Tests/FindLAPACK
parent95219365ff76d9f28eb0c09cf2ad73312a2da11f (diff)
downloadcmake-972489ae4e22179028b5e3ed8f908100665a368d.tar.gz
Find{BLAS,LAPACK}: Provide testing of BLA_SIZEOF_INTEGER
Diffstat (limited to 'Tests/FindLAPACK')
-rw-r--r--Tests/FindLAPACK/Test/CMakeLists.txt6
-rw-r--r--Tests/FindLAPACK/Test/main.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/Tests/FindLAPACK/Test/CMakeLists.txt b/Tests/FindLAPACK/Test/CMakeLists.txt
index 21b1303001..f5d5a7391d 100644
--- a/Tests/FindLAPACK/Test/CMakeLists.txt
+++ b/Tests/FindLAPACK/Test/CMakeLists.txt
@@ -4,12 +4,18 @@ include(CTest)
find_package(LAPACK REQUIRED)
+if(NOT BLA_SIZEOF_INTEGER)
+ set(BLA_SIZEOF_INTEGER 4)
+endif()
+
add_executable(test_tgt main.c)
target_link_libraries(test_tgt LAPACK::LAPACK)
+target_compile_definitions(test_tgt PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER})
add_test(NAME test_tgt COMMAND test_tgt)
add_executable(test_var main.c)
target_link_libraries(test_var PRIVATE ${LAPACK_LIBRARIES})
+target_compile_definitions(test_var PUBLIC BLA_SIZEOF_INTEGER=${BLA_SIZEOF_INTEGER})
add_test(NAME test_var COMMAND test_var)
if((BLA_VENDOR STREQUAL "Intel10_64lp") OR
diff --git a/Tests/FindLAPACK/Test/main.c b/Tests/FindLAPACK/Test/main.c
index 04eedeae16..dd33fb39a8 100644
--- a/Tests/FindLAPACK/Test/main.c
+++ b/Tests/FindLAPACK/Test/main.c
@@ -1,7 +1,14 @@
#include <assert.h>
+#include <stdint.h>
#include <string.h>
-typedef int blas_int;
+#if BLA_SIZEOF_INTEGER == 4
+typedef int32_t blas_int;
+#elif BLA_SIZEOF_INTEGER == 8
+typedef int64_t blas_int;
+#else
+# error BLA_SIZEOF_INTEGER is not declared!
+#endif
// declare what parts of the lapack C-API we need
void dgesv_(blas_int*, blas_int*, double*, blas_int*, blas_int*, double*,