poco/contrib/cmake/FindODBC.cmake
Marian Krivos 5b320c2894 Very basic but functional (at least on linux with gcc) support
for CMake build system
. 
It is strongly recomended to use out-of-source build to preserve
original Poco makefiles.

http://www.cmake.org/Wiki/CMake_FAQ#Out-of-source_build_trees

I have tested unix makefile generating and Eclipse CDT4 generating.

Supported are static/dynamic and debug/release targets. 
On now only core libs are included: CppUnit, Foundation,
Data, Data/SQLite, Util, Net and XML. But autodetection
of OpenSSL, MySQL and ODBC is working OK already.

CPack and CTest nor library install still doesn't work, only building.

This is only the start.
2009-02-15 15:49:19 +00:00

33 lines
977 B
CMake

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(FATAL_ERROR "Couldn't find unixODBC")
endif(NOT ODBC_CONFIG)
message(STATUS "unixODBC: Found 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}")
exec_program(${ODBC_CONFIG} ARGS "--libs" OUTPUT_VARIABLE ODBC_LINK_FLAGS)
else(WITH_UNIXODBC)
find_program(ODBC_CONFIG iodbc-config $ENV{ODBC_PATH}/bin PATHS)
if(NOT ODBC_CONFIG)
message(FATAL_ERROR "Couldn't find iODBC")
endif(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(WITH_UNIXODBC)