aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project')
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/CMakeLists.txt14
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/main.c27
2 files changed, 41 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/CMakeLists.txt
new file mode 100644
index 0000000..48baa06
--- /dev/null
+++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.30)
+project(unixodbc-test C)
+
+# legacy vcpkg-only name, now forwarding to "unofficial" names
+find_package(unixodbc CONFIG REQUIRED)
+
+add_executable(main main.c)
+target_link_libraries(main PRIVATE UNIX::odbc)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(unixodbc_pc odbc REQUIRED IMPORTED_TARGET)
+
+add_executable(main-pkconfig main.c)
+target_link_libraries(main-pkconfig PRIVATE PkgConfig::unixodbc_pc)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/main.c
new file mode 100644
index 0000000..cf182c1
--- /dev/null
+++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/main.c
@@ -0,0 +1,27 @@
+/* https://www.unixodbc.org/doc/ProgrammerManual/Tutorial/ has
+ * #include <odbc/sql.h>
+ * but actual pkgconfig files and MS ODBC documentation suggest
+ * #include <sql.h>
+ */
+#include <sql.h>
+#include <stdio.h>
+
+int main()
+{
+ SQLHENV odbc_handle;
+ long result = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &odbc_handle);
+ if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+ return 1;
+
+ SQLCHAR l_dsn[100], l_desc[100];
+ SQLUSMALLINT l_len1, l_len2, l_next;
+ for (short int l_next = SQL_FETCH_FIRST;
+ SQLDataSources(odbc_handle, l_next, l_dsn, sizeof(l_dsn), &l_len1, l_desc, sizeof(l_desc), &l_len2) == SQL_SUCCESS;
+ l_next = SQL_FETCH_NEXT)
+ {
+ printf("Server '%s' (%s)\n", l_dsn, l_desc);
+ }
+
+ SQLFreeHandle(SQL_HANDLE_ENV, odbc_handle);
+ return 0;
+}