Changeset: 5a4acce12d17 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5a4acce12d17
Added Files:
        clients/odbc/CMakeLists.txt
        clients/odbc/driver/CMakeLists.txt
        clients/odbc/samples/CMakeLists.txt
        clients/odbc/setup/CMakeLists.txt
        clients/odbc/winsetup/CMakeLists.txt
Modified Files:
        CMakeLists.txt
        clients/CMakeLists.txt
Branch: cmake-fun
Log Message:

Steps into compiling the ODBC driver.


diffs (270 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1368,30 +1368,38 @@ set(ENABLE_ODBC "AUTO" CACHE STRING "Com
 if(NOT ${ENABLE_ODBC} STREQUAL "NO")
        cmake_push_check_state()
        if(MSVC)
-               check_include_file("odbcinst.h" HAVE_ODBCINST_H)
-               if(NOT HAVE_ODBCINST_H)
-                       message(STATUS "odbcinst.h not found")
-               endif()
-
-               set(FOUND_ODBCINST_LIBRARIES )
-               find_library(ODBCINST_LIBRARIES NAMES odbccp32)
-               if(ODBCINST_LIBRARIES)
-                       list(APPEND FOUND_ODBCINST_LIBRARIES "odbccp32")
-               endif()
-               find_library(ODBCINST_LIBRARIES NAMES user32)
-               if(ODBCINST_LIBRARIES)
-                       list(APPEND FOUND_ODBCINST_LIBRARIES "user32")
-               endif()
-               set(ODBC_LIBRARIES "${FOUND_ODBCINST_LIBRARIES}")
-               find_library(ODBC_LIBRARIES NAMES odbc32)
-
                set(HAVE_SQLGETPRIVATEPROFILESTRING ON)
                if(CMAKE_SIZEOF_VOID_P EQUAL 8) # Windows 64 bit
                        set(LENP_OR_POINTER_T "SQLLEN *")
                else()
                        set(LENP_OR_POINTER_T "SQLPOINTER")
                endif()
-               set(HAVE_ODBC YES)
+
+               check_include_file("odbcinst.h" HAVE_ODBCINST_H)
+               if(HAVE_ODBCINST_H)
+                       set(FOUND_ODBCINST_LIBRARIES )
+                       find_library(ODBCINST_LIBRARIES NAMES odbccp32)
+                       if(ODBCINST_LIBRARIES)
+                               list(APPEND FOUND_ODBCINST_LIBRARIES odbccp32)
+                       endif()
+                       find_library(ODBCINST_LIBRARIES NAMES user32)
+                       if(ODBCINST_LIBRARIES)
+                               list(APPEND FOUND_ODBCINST_LIBRARIES user32)
+                       endif()
+                       find_library(ODBCINST_LIBRARIES NAMES 
legacy_stdio_definitions)
+                       if(ODBCINST_LIBRARIES)
+                               list(APPEND FOUND_ODBCINST_LIBRARIES 
legacy_stdio_definitions)
+                       endif()
+                       find_library(ODBC_LIBRARIES NAMES odbc32)
+
+                       list(LENGTH ${FOUND_ODBCINST_LIBRARIES} 
FOUND_ODBCINST_LIBRARIES_LENGTH)
+                       if(${FOUND_ODBCINST_LIBRARIES_LENGTH} EQUAL 3 AND 
ODBC_LIBRARIES)
+                               set(ODBCINST_LIBRARIES 
"${FOUND_ODBCINST_LIBRARIES}")
+                               set(HAVE_ODBC YES)
+                       endif()
+               else()
+                       message(STATUS "odbcinst.h not found")
+               endif()
        else()
                set(WITH_UNIXODBC "AUTO" CACHE PATH "unixODBC library is 
installed in DIR")
                if(NOT ${WITH_UNIXODBC} STREQUAL "NO")
diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt
--- a/clients/CMakeLists.txt
+++ b/clients/CMakeLists.txt
@@ -10,9 +10,9 @@ if(HAVE_MAPI)
        add_subdirectory(mapilib)
        add_subdirectory(mapiclient)
 endif()
-#[[if(HAVE_ODBC)
+if(HAVE_ODBC)
        add_subdirectory(odbc)
-endif()#]]
+endif()
 if(HAVE_MAPI)
        add_subdirectory(examples)
 endif()
diff --git a/clients/odbc/CMakeLists.txt b/clients/odbc/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/clients/odbc/CMakeLists.txt
@@ -0,0 +1,15 @@
+#[[
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+#]]
+
+if(WIN32)
+       add_subdirectory(winsetup)
+else()
+       add_subdirectory(setup)
+endif()
+add_subdirectory(driver)
+add_subdirectory(samples)
diff --git a/clients/odbc/driver/CMakeLists.txt 
b/clients/odbc/driver/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/clients/odbc/driver/CMakeLists.txt
@@ -0,0 +1,105 @@
+#[[
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+#]]
+
+include_directories(../../mapilib ../../../common/options ${ODBC_INCLUDE_DIR})
+
+add_library(MonetODBC MODULE
+                       ODBCConvert.c
+                       ODBCDbc.c
+                       ODBCDbc.h
+                       ODBCDesc.c
+                       ODBCDesc.h
+                       ODBCEnv.c
+                       ODBCEnv.h
+                       ODBCError.c
+                       ODBCError.h
+                       ODBCGlobal.h
+                       ODBCQueries.h
+                       ODBCStmt.c
+                       ODBCStmt.h
+                       ODBCUtil.c
+                       ODBCUtil.h
+                       SQLAllocConnect.c
+                       SQLAllocEnv.c
+                       SQLAllocHandle.c
+                       SQLAllocStmt.c
+                       SQLBindCol.c
+                       SQLBindParameter.c
+                       SQLBrowseConnect.c
+                       SQLBulkOperations.c
+                       SQLCancel.c
+                       SQLCloseCursor.c
+                       SQLColAttribute.c
+                       SQLColAttributes.c
+                       SQLColumnPrivileges.c
+                       SQLColumns.c
+                       SQLConnect.c
+                       SQLCopyDesc.c
+                       SQLDataSources.c
+                       SQLDescribeCol.c
+                       SQLDescribeParam.c
+                       SQLDisconnect.c
+                       SQLDriverConnect.c
+                       SQLDrivers.c
+                       SQLEndTran.c
+                       SQLError.c
+                       SQLExecDirect.c
+                       SQLExecute.c
+                       SQLExtendedFetch.c
+                       SQLFetch.c
+                       SQLFetchScroll.c
+                       SQLForeignKeys.c
+                       SQLFreeConnect.c
+                       SQLFreeEnv.c
+                       SQLFreeHandle.c
+                       SQLFreeStmt.c
+                       SQLGetConnectAttr.c
+                       SQLGetConnectOption.c
+                       SQLGetCursorName.c
+                       SQLGetData.c
+                       SQLGetDescField.c
+                       SQLGetDescRec.c
+                       SQLGetDiagField.c
+                       SQLGetDiagRec.c
+                       SQLGetEnvAttr.c
+                       SQLGetFunctions.c
+                       SQLGetInfo.c
+                       SQLGetStmtAttr.c
+                       SQLGetStmtOption.c
+                       SQLGetTypeInfo.c
+                       SQLMoreResults.c
+                       SQLNativeSql.c
+                       SQLNumParams.c
+                       SQLNumResultCols.c
+                       SQLParamData.c
+                       SQLParamOptions.c
+                       SQLPrepare.c
+                       SQLPrimaryKeys.c
+                       SQLProcedureColumns.c
+                       SQLProcedures.c
+                       SQLPutData.c
+                       SQLRowCount.c
+                       SQLSetConnectAttr.c
+                       SQLSetConnectOption.c
+                       SQLSetCursorName.c
+                       SQLSetDescField.c
+                       SQLSetDescRec.c
+                       SQLSetEnvAttr.c
+                       SQLSetParam.c
+                       SQLSetPos.c
+                       SQLSetScrollOptions.c
+                       SQLSetStmtAttr.c
+                       SQLSetStmtOption.c
+                       SQLSpecialColumns.c
+                       SQLStatistics.c
+                       SQLTablePrivileges.c
+                       SQLTables.c
+                       SQLTransact.c)
+target_link_libraries(MonetODBC PRIVATE mapi stream ${ICONV_LIBRARIES} 
${ODBCINST_LIBRARIES} ${CRYPTO_LIBRARIES}
+                                         ${SOCKET_LIBRARIES})
+install(TARGETS MonetODBC DESTINATION ${LIBDIR})
diff --git a/clients/odbc/samples/CMakeLists.txt 
b/clients/odbc/samples/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/clients/odbc/samples/CMakeLists.txt
@@ -0,0 +1,21 @@
+#[[
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+#]]
+
+include_directories(${ODBC_INCLUDE_DIR})
+
+if(HAVE_TESTING)
+       add_executable(odbcsample1 odbcsample1.c)
+       target_link_libraries(odbcsample1 PRIVATE ${ODBC_LIBRARIES})
+       add_executable(testgetinfo testgetinfo.c)
+       target_link_libraries(testgetinfo PRIVATE ${ODBC_LIBRARIES})
+       add_executable(arraytest arraytest.c)
+       target_link_libraries(arraytest PRIVATE ${ODBC_LIBRARIES})
+       add_executable(testStmtAttr testStmtAttr.c)
+       target_link_libraries(testStmtAttr PRIVATE ${ODBC_LIBRARIES})
+       install(TARGETS odbcsample1 testgetinfo arraytest testStmtAttr 
DESTINATION ${BINDIR})
+endif()
diff --git a/clients/odbc/setup/CMakeLists.txt 
b/clients/odbc/setup/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/clients/odbc/setup/CMakeLists.txt
@@ -0,0 +1,12 @@
+#[[
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+#]]
+
+include_directories(${ODBC_INCLUDE_DIR})
+
+add_library(MonetODBCs MODULE drvcfg.c drvcfg.h)
+install(TARGETS MonetODBCs DESTINATION ${LIBDIR})
diff --git a/clients/odbc/winsetup/CMakeLists.txt 
b/clients/odbc/winsetup/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/clients/odbc/winsetup/CMakeLists.txt
@@ -0,0 +1,17 @@
+#[[
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0.  If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
+#]]
+
+include_directories(../include ../driver ${ODBC_INCLUDE_DIR})
+
+add_library(MonetODBCs SHARED setup.c setup.rc setup.syms resource.h)
+target_link_libraries(gdk PRIVATE ${ODBCINST_LIBRARIES})
+install(TARGETS MonetODBCs DESTINATION ${LIBDIR})
+
+add_executable(odbcinstall install.c)
+target_link_libraries(gdk PRIVATE ${ODBC_LIBRARIES} ${ODBCINST_LIBRARIES})
+install(TARGETS odbcinstall DESTINATION ${BINDIR})
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to