summaryrefslogtreecommitdiffstats
path: root/Tests/FindODBC
diff options
context:
space:
mode:
authorMateusz Loskot <mateusz@loskot.net>2018-05-11 20:31:01 (GMT)
committerMateusz Loskot <mateusz@loskot.net>2018-05-22 19:29:22 (GMT)
commit357db10bd1e154a5f5092b55395a236bb40dc5d6 (patch)
tree8d6600b05ee0e92036e6a8d18c54a53c78faa825 /Tests/FindODBC
parente6a32f0525d936990ee6df5441d510fa6255f696 (diff)
downloadCMake-357db10bd1e154a5f5092b55395a236bb40dc5d6.zip
CMake-357db10bd1e154a5f5092b55395a236bb40dc5d6.tar.gz
CMake-357db10bd1e154a5f5092b55395a236bb40dc5d6.tar.bz2
FindODBC: Add module to search for ODBC library
Add tests for FindODBC module.
Diffstat (limited to 'Tests/FindODBC')
-rw-r--r--Tests/FindODBC/CMakeLists.txt10
-rw-r--r--Tests/FindODBC/Test/CMakeLists.txt14
-rw-r--r--Tests/FindODBC/Test/main.c12
3 files changed, 36 insertions, 0 deletions
diff --git a/Tests/FindODBC/CMakeLists.txt b/Tests/FindODBC/CMakeLists.txt
new file mode 100644
index 0000000..6a81090
--- /dev/null
+++ b/Tests/FindODBC/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_test(NAME FindODBC.Test COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindODBC/Test"
+ "${CMake_BINARY_DIR}/Tests/FindODBC/Test"
+ ${build_generator_args}
+ --build-project TestFindODBC
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
diff --git a/Tests/FindODBC/Test/CMakeLists.txt b/Tests/FindODBC/Test/CMakeLists.txt
new file mode 100644
index 0000000..a20c0f7
--- /dev/null
+++ b/Tests/FindODBC/Test/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.1)
+project(TestFindODBC C)
+include(CTest)
+
+find_package(ODBC)
+
+add_executable(test_odbc_tgt main.c)
+target_link_libraries(test_odbc_tgt ODBC::ODBC)
+add_test(NAME test_odbc_tgt COMMAND test_odbc_tgt)
+
+add_executable(test_odbc_var main.c)
+target_include_directories(test_odbc_var PRIVATE ${ODBC_INCLUDE_DIRS})
+target_link_libraries(test_odbc_var PRIVATE ${ODBC_LIBRARIES})
+add_test(NAME test_odbc_var COMMAND test_odbc_var)
diff --git a/Tests/FindODBC/Test/main.c b/Tests/FindODBC/Test/main.c
new file mode 100644
index 0000000..917167b
--- /dev/null
+++ b/Tests/FindODBC/Test/main.c
@@ -0,0 +1,12 @@
+#ifdef WIN32
+#include <windows.h>
+#endif
+#include <sql.h>
+
+int main()
+{
+ SQLHENV env;
+ SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
+ SQLFreeHandle(SQL_HANDLE_ENV, env);
+ return 0;
+}