added last Poco module to cmake infrastructure - PocoODBC (working at least on linux32 + unixodbc + gcc 4.3.2)

This commit is contained in:
Marian Krivos 2009-03-08 17:03:18 +00:00
parent e0c971a581
commit c4f6084c25
5 changed files with 80 additions and 34 deletions

View File

@ -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)

View File

@ -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 )

View File

@ -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 )

View File

@ -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 )

View File

@ -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)