diff --git a/CMakeLists.txt b/CMakeLists.txt index 2622c30a6..f4a4ae810 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,6 @@ include(FindCygwin) include(FindOpenSSL) include(contrib/cmake/FindMySQL.cmake) -include(contrib/cmake/FindODBC.cmake) include(contrib/cmake/FindAPR.cmake) include(contrib/cmake/FindApache2.cmake) diff --git a/Data/CMakeLists.txt b/Data/CMakeLists.txt index 24bcc1bce..ac31e42f7 100644 --- a/Data/CMakeLists.txt +++ b/Data/CMakeLists.txt @@ -29,11 +29,15 @@ install( ) add_subdirectory( SQLite ) + if(MYSQL_FOUND) add_subdirectory( MySQL ) endif(MYSQL_FOUND) -if(ODBC_CONFIG) -# add_subdirectory( ODBC ) + +include(../contrib/cmake/FindODBC.cmake) + +if(NOT ODBC_CONFIG-NOT_FOUND) + add_subdirectory( ODBC ) endif(ODBC_CONFIG) add_subdirectory( samples ) diff --git a/Data/ODBC/CMakeLists.txt b/Data/ODBC/CMakeLists.txt index 0dd19f9fb..41e3e1921 100644 --- a/Data/ODBC/CMakeLists.txt +++ b/Data/ODBC/CMakeLists.txt @@ -1,8 +1,22 @@ set(LIBNAME "PocoODBC") set(LIBNAMED "${LIBNAME}d") -set(SRCS "") -aux_source_directory(src SRCS) +set(SRCS +src/Binder.cpp +src/ConnectionHandle.cpp +src/Connector.cpp +src/EnvironmentHandle.cpp +src/Extractor.cpp +src/ODBCException.cpp +src/ODBCMetaColumn.cpp +src/ODBCStatementImpl.cpp +src/Parameter.cpp +src/Preparator.cpp +src/SessionImpl.cpp +src/TypeInfo.cpp +src/Unicode.cpp +src/Utility.cpp +) add_definitions( ${ODBC_CFLAGS} ) @@ -32,4 +46,4 @@ install( DESTINATION lib ) -#add_subdirectory( testsuite ) +add_subdirectory( testsuite ) diff --git a/Data/ODBC/testsuite/CMakeLists.txt b/Data/ODBC/testsuite/CMakeLists.txt new file mode 100644 index 000000000..4ef090bfa --- /dev/null +++ b/Data/ODBC/testsuite/CMakeLists.txt @@ -0,0 +1,26 @@ +set( TEST_SRCS +src/Driver.cpp +src/ODBCAccessTest.cpp +src/ODBCDB2Test.cpp +src/ODBCMySQLTest.cpp +src/ODBCOracleTest.cpp +src/ODBCPostgreSQLTest.cpp +src/ODBCSQLServerTest.cpp +src/ODBCSQLiteTest.cpp +src/ODBCTest.cpp +src/ODBCTestSuite.cpp +src/SQLExecutor.cpp +) + +#include_directories() + +set( WIN_TEST_SRCS +src/WinDriver.cpp +) + +set(TESTUNIT "${LIBNAME}-testrunner") + +add_executable( ${TESTUNIT} ${TEST_SRCS} ) +set_target_properties( ${TESTUNIT} PROPERTIES COMPILE_FLAGS ${RELEASE_CXX_FLAGS} ) +target_link_libraries( ${TESTUNIT} PocoODBC PocoData PocoFoundation CppUnit ) + diff --git a/contrib/cmake/FindODBC.cmake b/contrib/cmake/FindODBC.cmake index 675a4fa19..ae42fb0d2 100644 --- a/contrib/cmake/FindODBC.cmake +++ b/contrib/cmake/FindODBC.cmake @@ -1,34 +1,37 @@ -if(WITH_UNIXODBC) - # check for location of odbc_config - find_program(ODBC_CONFIG odbc_config $ENV{ODBC_PATH}/bin PATHS) - - if(NOT ODBC_CONFIG) - message(STATUS "Couldn't find unixODBC") - else(NOT ODBC_CONFIG) - - message(STATUS "unixODBC: Found odbc_config in ${ODBC_CONFIG}") +# check for location of odbc_config +find_program(ODBC_CONFIG odbc_config + $ENV{ODBC_PATH}/bin + /usr/bin + /usr/local/bin + PATHS) +if(ODBC_CONFIG-NOT_FOUND) + message(STATUS "Couldn't find unixODBC") +else(NOT ODBC_CONFIG) + message(STATUS "Found unixODBC: odbc_config in ${ODBC_CONFIG}") exec_program(${ODBC_CONFIG} ARGS "--include-prefix" OUTPUT_VARIABLE ODBC_INCLUDE_DIR) - set (CMAKE_FLAGS "${CMAKE_FLAGS} -I${ODBC_INCLUDE_DIR}") - + include_directories(${ODBC_INCLUDE_DIR}) exec_program(${ODBC_CONFIG} ARGS "--libs" OUTPUT_VARIABLE ODBC_LINK_FLAGS) - endif(NOT ODBC_CONFIG) + add_definitions(-DPOCO_UNIXODBC) +endif(ODBC_CONFIG-NOT_FOUND) -else(WITH_UNIXODBC) - - find_program(ODBC_CONFIG iodbc-config $ENV{ODBC_PATH}/bin PATHS) - - if(NOT ODBC_CONFIG) +if(ODBC_CONFIG-NOT_FOUND) + find_program(ODBC_CONFIG iodbc-config + $ENV{ODBC_PATH}/bin + /usr/bin + /usr/local/bin + PATHS) + if(ODBC_CONFIG-NOT_FOUND) message(STATUS "Couldn't find iODBC") - else(NOT ODBC_CONFIG) - - message(STATUS "iODBC: Found iodbc-config in ${ODBC_CONFIG}") - - exec_program(${ODBC_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE ODBC_CFLAGS) - set(CMAKE_FLAGS "${CMAKE_FLAGS} ${ODBC_CFLAGS}") - - exec_program(${ODBC_CONFIG} ARGS "--libs" OUTPUT_VARIABLE ODBC_LINK_FLAGS) - endif(NOT ODBC_CONFIG) - -endif(WITH_UNIXODBC) + else(ODBC_CONFIG-NOT_FOUND) + message(STATUS "Found iODBC: iodbc-config in ${ODBC_CONFIG}") + exec_program(${ODBC_CONFIG} ARGS "--cflags" OUTPUT_VARIABLE ODBC_CFLAGS) + add_definitions( ${ODBC_CFLAGS} ) + exec_program(${ODBC_CONFIG} ARGS "--libs" OUTPUT_VARIABLE ODBC_LINK_FLAGS) + add_definitions(-DPOCO_IODBC) + endif(ODBC_CONFIG-NOT_FOUND) +endif(ODBC_CONFIG-NOT_FOUND) +if(ODBC_CONFIG-NOT_FOUND) + #try odbc32.lib on windows +endif(ODBC_CONFIG-NOT_FOUND)