diff options
author | Mateusz Loskot <mateusz@loskot.net> | 2018-05-11 20:31:01 (GMT) |
---|---|---|
committer | Mateusz Loskot <mateusz@loskot.net> | 2018-05-22 19:29:22 (GMT) |
commit | 357db10bd1e154a5f5092b55395a236bb40dc5d6 (patch) | |
tree | 8d6600b05ee0e92036e6a8d18c54a53c78faa825 /Tests | |
parent | e6a32f0525d936990ee6df5441d510fa6255f696 (diff) | |
download | CMake-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')
-rw-r--r-- | Tests/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/FindODBC/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Tests/FindODBC/Test/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindODBC/Test/main.c | 12 |
4 files changed, 40 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index fe8f2cc..0e94388 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1438,6 +1438,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindLTTngUST) endif() + if(CMake_TEST_FindODBC) + add_subdirectory(FindODBC) + endif() + if(CMake_TEST_FindOpenCL) add_subdirectory(FindOpenCL) endif() 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; +} |