aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/scripts/test_ports/vcpkg-ci-unixodbc')
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/portfile.cmake9
-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
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/vcpkg.json14
4 files changed, 64 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/portfile.cmake
new file mode 100644
index 0000000..0122f05
--- /dev/null
+++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/portfile.cmake
@@ -0,0 +1,9 @@
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_find_acquire_program(PKGCONFIG)
+set(ENV{PKG_CONFIG} "${PKGCONFIG}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CURRENT_PORT_DIR}/project"
+)
+vcpkg_cmake_build()
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;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/vcpkg.json
new file mode 100644
index 0000000..6973fa9
--- /dev/null
+++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/vcpkg.json
@@ -0,0 +1,14 @@
+{
+ "name": "vcpkg-ci-unixodbc",
+ "version-string": "ci",
+ "description": "Test port for unixodbc usage",
+ "homepage": "https://github.com/microsoft/vcpkg",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ "unixodbc"
+ ]
+}