summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--src/sql/CMakeLists.txt71
2 files changed, 41 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c4c76062..67e6c3d08 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,7 +121,7 @@ option( WITH_MODULE_STYLES "Build the styles module" ${WITH_MODULE_AL
option( WITH_MODULE_SQL "Build the SQL module" ${WITH_MODULE_ALL} )
-##### user requested styles:
+##### user requested styles
option( BUILD_STYLE_PLUGIN_ALL "Build all styles as plugins" OFF )
option( BUILD_STYLE_PLUGIN_MOTIF "Build Motif style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
@@ -150,7 +150,7 @@ option( WITH_STYLE_INTERLACE "Build interlace style" OFF )
##### user requested sql modules
-option( BUILD_SQL_PLUGIN_ALL "Build all sql plugins" ${WITH_MODULE_SQL} )
+option( BUILD_SQL_PLUGIN_ALL "Build all sql plugins" OFF )
option( BUILD_SQL_PLUGIN_PSQL "Build plugin for PostgreSQL" ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_MYSQL "Build plugin for MySQL" ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_ODBC "Build plugin for ODBC" ${BUILD_SQL_PLUGIN_ALL} )
@@ -159,7 +159,7 @@ option( BUILD_SQL_PLUGIN_IBASE "Build plugin for Firebird" ${BUILD_SQL_PLUGI
option( BUILD_SQL_PLUGIN_SQLITE3 "Build plugin for SQLite3" ${BUILD_SQL_PLUGIN_ALL} )
-option( WITH_SQL_DRIVER_ALL "Build all sql drivers" OFF )
+option( WITH_SQL_DRIVER_ALL "Build all sql drivers" ${WITH_ALL_OPTIONS} )
option( WITH_SQL_DRIVER_PSQL "Build support for PostgreSQL" ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_MYSQL "Build support for MySQL" ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_ODBC "Build support for ODBC" ${WITH_SQL_DRIVER_ALL} )
diff --git a/src/sql/CMakeLists.txt b/src/sql/CMakeLists.txt
index 1f42df9cc..2b81806fd 100644
--- a/src/sql/CMakeLists.txt
+++ b/src/sql/CMakeLists.txt
@@ -41,40 +41,45 @@ set( _SRC_ qsqlquery.cpp
./drivers/cache/qsqlcachedresult.cpp
)
-set( _sql_drivers "" )
-set( _sql_libraries "" )
+set( _PSQL_src drivers/psql/qsql_psql.cpp )
+set( _MYSQL_src drivers/mysql/qsql_mysql.cpp )
+set( _ODBC_src drivers/odbc/qsql_odbc.cpp )
+set( _IBASE_src drivers/ibase/qsql_ibase.cpp )
+set( _SQLITE_src drivers/sqlite/qsql_sqlite.cpp )
+set( _SQLITE3_src drivers/sqlite3/qsql_sqlite3.cpp )
-if( WITH_SQL_DRIVER_PSQL )
- list( APPEND _SRC_ drivers/psql/qsql_psql.cpp )
- list( APPEND _sql_drivers "QT_SQL_POSTGRES" )
- list( APPEND _sql_libraries ${PostgreSQL_LIBRARIES} )
-endif()
-if ( WITH_SQL_DRIVER_MYSQL )
- list( APPEND _SRC_ drivers/mysql/qsql_mysql.cpp )
- list( APPEND _sql_drivers "QT_SQL_MYSQL" )
- list( APPEND _sql_libraries ${MYSQL_LIBRARIES} )
-endif()
-if( WITH_SQL_DRIVER_ODBC )
- list( APPEND _SRC_ drivers/odbc/qsql_odbc.cpp )
- list( APPEND _sql_drivers "QT_SQL_ODBC" )
- list( APPEND _sql_libraries ${ODBC_LIBRARIES} )
-endif()
-if( WITH_SQL_DRIVER_IBASE )
- list( APPEND _SRC_ drivers/ibase/qsql_ibase.cpp )
- list( APPEND _sql_drivers "QT_SQL_IBASE" )
- list( APPEND _sql_libraries ${FBCLIENT_LIBRARIES} )
-endif()
-if( WITH_SQL_DRIVER_SQLITE2 )
- list( APPEND _SRC_ drivers/sqlite/qsql_sqlite.cpp )
- list( APPEND _sql_drivers "QT_SQL_SQLITE" )
- list( APPEND _sql_libraries ${SQLITE_LIBRARIES} )
-endif()
-if( WITH_SQL_DRIVER_SQLITE3 )
- list( APPEND _SRC_ drivers/sqlite3/qsql_sqlite3.cpp )
- list( APPEND _sql_drivers "QT_SQL_SQLITE3" )
- list( APPEND _sql_libraries ${SQLITE3_LIBRARIES} )
-endif()
+set( _PSQL_libraries ${PostgreSQL_LIBRARIES} )
+set( _MYSQL_libraries ${MYSQL_LIBRARIES} )
+set( _ODBC_libraries ${ODBC_LIBRARIES} )
+set( _IBASE_libraries ${FBCLIENT_LIBRARIES} )
+set( _SQLITE_libraries ${SQLITE_LIBRARIES} )
+set( _SQLITE3_libraries ${SQLITE3_LIBRARIES} )
+set( _PSQL_flag "QT_SQL_POSTGRES" )
+set( _MYSQL_flag "QT_SQL_MYSQL" )
+set( _ODBC_flag "QT_SQL_ODBC" )
+set( _IBASE_flag "QT_SQL_IBASE" )
+set( _SQLITE_flag "QT_SQL_SQLITE" )
+set( _SQLITE3_flag "QT_SQL_SQLITE3" )
+
+unset( _sql_libraries )
+unset( _sql_driver_flags )
+
+foreach(_driver PSQL MYSQL ODBC IBASE SQLITE SQLITE3)
+ if( BUILD_SQL_PLUGIN_${_driver} )
+ string( TOLOWER "q${_driver}" _plugin_lib )
+ tde_add_library( ${_plugin_lib} SHARED
+ SOURCES ${_${_driver}_src}
+ LINK tqt-mt-shared ${_${_driver}_libraries}
+ DESTINATION "${QT_INSTALL_PLUGINS}/sqldrivers"
+ )
+ tqt_automoc( ${_plugin_lib}-shared )
+ elseif( WITH_SQL_DRIVER_${_driver})
+ list( APPEND _SRC_ ${_${_driver}_src} )
+ list( APPEND _sql_driver_flags ${_${_driver}_flag} )
+ list( APPEND _sql_libraries ${_${_driver}_libraries} )
+ endif()
+endforeach()
tde_add_library( ${target} STATIC_PIC
@@ -95,6 +100,6 @@ set( tqtlib_embed ${tqtlib_embed} PARENT_SCOPE )
set_property( TARGET ${target}-static
APPEND PROPERTY COMPILE_DEFINITIONS
${NO_XCURSOR} TQT_NO_MESSAGEBOX
- ${_sql_drivers}
+ ${_sql_driver_flags}
)
set_property( SOURCE qsql_psql.h APPEND PROPERTY COMPILE_DEFINITIONS QT_PLUGIN )