mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 18:20:26 +01:00
cmake: Data cleanup
- explicitly list files - use find_package for MySQL and ODBC - remove unused code - remove unnecessary include dirs - support unbundled SQLite3 - replace tabs by spaces Reviewed-by: Roger Meier <r.meier@siemens.com>
This commit is contained in:
parent
216ecd3ec2
commit
0fd90ec722
@ -1,11 +1,46 @@
|
||||
set(LIBNAME "PocoData")
|
||||
|
||||
set(SRCS "")
|
||||
aux_source_directory(src SRCS)
|
||||
include_directories( SQLite/include )
|
||||
set(SRCS
|
||||
src/AbstractBinder.cpp
|
||||
src/AbstractBinding.cpp
|
||||
src/AbstractExtraction.cpp
|
||||
src/AbstractExtractor.cpp
|
||||
src/AbstractPreparation.cpp
|
||||
src/AbstractPreparator.cpp
|
||||
src/ArchiveStrategy.cpp
|
||||
src/Bulk.cpp
|
||||
src/Connector.cpp
|
||||
src/DataException.cpp
|
||||
src/Date.cpp
|
||||
src/DynamicLOB.cpp
|
||||
src/Limit.cpp
|
||||
src/MetaColumn.cpp
|
||||
src/PooledSessionHolder.cpp
|
||||
src/PooledSessionImpl.cpp
|
||||
src/Position.cpp
|
||||
src/Range.cpp
|
||||
src/RecordSet.cpp
|
||||
src/Row.cpp
|
||||
src/RowFilter.cpp
|
||||
src/RowFormatter.cpp
|
||||
src/RowIterator.cpp
|
||||
src/Session.cpp
|
||||
src/SessionFactory.cpp
|
||||
src/SessionImpl.cpp
|
||||
src/SessionPoolContainer.cpp
|
||||
src/SessionPool.cpp
|
||||
src/SimpleRowFormatter.cpp
|
||||
src/SQLChannel.cpp
|
||||
src/Statement.cpp
|
||||
src/StatementCreator.cpp
|
||||
src/StatementImpl.cpp
|
||||
src/Time.cpp
|
||||
src/Transaction.cpp
|
||||
)
|
||||
|
||||
|
||||
if (NOT POCO_STATIC)
|
||||
add_definitions(-DData_EXPORTS -DTHREADSAFE -DODBC_EXPORTS -DMySQL_EXPORTS -DSQLite_EXPORTS)
|
||||
add_definitions(-DData_EXPORTS -DTHREADSAFE -DODBC_EXPORTS -DMySQL_EXPORTS -DSQLite_EXPORTS)
|
||||
endif (NOT POCO_STATIC)
|
||||
|
||||
if(MSVC AND NOT(MSVC_VERSION LESS 1400))
|
||||
@ -14,9 +49,9 @@ if(MSVC AND NOT(MSVC_VERSION LESS 1400))
|
||||
endif()
|
||||
|
||||
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
target_link_libraries( ${LIBNAME} PocoFoundation)
|
||||
|
||||
install(
|
||||
@ -24,7 +59,7 @@ install(
|
||||
DESTINATION include
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
|
||||
install(
|
||||
TARGETS ${LIBNAME}
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
@ -32,27 +67,28 @@ install(
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
# SQlite3 is built in any case
|
||||
add_subdirectory( SQLite )
|
||||
|
||||
find_package(MySQL)
|
||||
if(MYSQL_FOUND)
|
||||
add_subdirectory( MySQL )
|
||||
endif(MYSQL_FOUND)
|
||||
|
||||
include(FindODBC)
|
||||
|
||||
find_package(ODBC)
|
||||
if(CMAKE_SYSTEM MATCHES "Windows")
|
||||
message(STATUS "Windows native ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
message(STATUS "Windows native ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
else ()
|
||||
if ( ${UNIX_ODBC_CONFIG} STREQUAL UNIX_ODBC_CONFIG-NOTFOUND AND ${IODBC_CONFIG} STREQUAL IODBC_CONFIG-NOTFOUND)
|
||||
message(STATUS "ODBC Support Disabled - no ODBC runtime")
|
||||
else ()
|
||||
message(STATUS "ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
endif ()
|
||||
if ( ${UNIX_ODBC_CONFIG} STREQUAL UNIX_ODBC_CONFIG-NOTFOUND AND ${IODBC_CONFIG} STREQUAL IODBC_CONFIG-NOTFOUND)
|
||||
message(STATUS "ODBC Support Disabled - no ODBC runtime")
|
||||
else ()
|
||||
message(STATUS "ODBC Support Enabled")
|
||||
add_subdirectory( ODBC )
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(samples)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
@ -1,17 +1,26 @@
|
||||
set(LIBNAME "PocoDataMySQL")
|
||||
|
||||
set(SRCS "")
|
||||
aux_source_directory(src SRCS)
|
||||
set(SRCS
|
||||
src/Binder.cpp
|
||||
src/Connector.cpp
|
||||
src/Extractor.cpp
|
||||
src/MySQLException.cpp
|
||||
src/MySQLStatementImpl.cpp
|
||||
src/ResultMetadata.cpp
|
||||
src/SessionHandle.cpp
|
||||
src/SessionImpl.cpp
|
||||
src/StatementExecutor.cpp
|
||||
src/Utility.cpp
|
||||
)
|
||||
|
||||
add_definitions(-DTHREADSAFE -DNO_TCL)
|
||||
|
||||
include_directories( include ${MYSQL_INCLUDE_DIR})
|
||||
#link_directories( )
|
||||
|
||||
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${MYSQL_LIB})
|
||||
|
||||
install(
|
||||
@ -28,5 +37,5 @@ install(
|
||||
)
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
@ -1,20 +1,20 @@
|
||||
set(LIBNAME "PocoDataODBC")
|
||||
|
||||
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
|
||||
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} )
|
||||
@ -23,8 +23,8 @@ include_directories( include )
|
||||
|
||||
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
target_link_libraries( ${LIBNAME} PocoData PocoFoundation ${ODBC_LINK_FLAGS})
|
||||
|
||||
install(
|
||||
@ -41,5 +41,5 @@ install(
|
||||
)
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
@ -1,34 +1,33 @@
|
||||
set(LIBNAME "PocoDataSQLite")
|
||||
|
||||
include_directories( include src )
|
||||
|
||||
set(SRCS "")
|
||||
|
||||
set(SRCS
|
||||
src/Binder.cpp
|
||||
src/Connector.cpp
|
||||
src/Extractor.cpp
|
||||
src/Notifier.cpp
|
||||
src/SQLiteException.cpp
|
||||
src/SQLiteStatementImpl.cpp
|
||||
src/SessionImpl.cpp
|
||||
src/Utility.cpp
|
||||
set(SRCS
|
||||
src/Binder.cpp
|
||||
src/Connector.cpp
|
||||
src/Extractor.cpp
|
||||
src/Notifier.cpp
|
||||
src/SessionImpl.cpp
|
||||
src/SQLiteException.cpp
|
||||
src/SQLiteStatementImpl.cpp
|
||||
src/Utility.cpp
|
||||
)
|
||||
|
||||
include_directories( "include" src )
|
||||
|
||||
if (POCO_UNBUNDLED)
|
||||
set(DATASQLITELIBS PocoData PocoFoundation sqlite3)
|
||||
find_package(SQLite3)
|
||||
set(DATASQLITELIBS PocoData PocoFoundation ${SQLITE3_LIBRARIES})
|
||||
include_directories(${SQLITE3_INCLUDE_DIRS})
|
||||
else()
|
||||
set(SRCS ${SRCS} src/sqlite3.c)
|
||||
set(DATASQLITELIBS PocoData PocoFoundation)
|
||||
set(SRCS ${SRCS} src/sqlite3.c)
|
||||
set(DATASQLITELIBS PocoData PocoFoundation)
|
||||
endif()
|
||||
|
||||
add_definitions(-DSQLITE_THREADSAFE=1 -DSQLITE_DISABLE_LFS -DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_DEPRECATED)
|
||||
|
||||
add_library( ${LIBNAME} ${LIB_MODE} ${SRCS} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
set_target_properties( ${LIBNAME}
|
||||
PROPERTIES
|
||||
VERSION ${SHARED_LIBRARY_VERSION} SOVERSION ${SHARED_LIBRARY_VERSION} )
|
||||
target_link_libraries( ${LIBNAME} ${DATASQLITELIBS} )
|
||||
|
||||
install(
|
||||
@ -36,7 +35,7 @@ install(
|
||||
DESTINATION include
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
|
||||
install(
|
||||
TARGETS ${LIBNAME}
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
@ -45,6 +44,6 @@ install(
|
||||
)
|
||||
|
||||
if (ENABLE_TESTS)
|
||||
add_subdirectory(testsuite)
|
||||
add_subdirectory(testsuite)
|
||||
endif ()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user