QMYSQL and CMAKE
Hi,
I’m trying to compile an application with Qt’s MYSQL driver and cmake. Everything compiles correctly, but when I start the application, I’m getting the following error:
- QSqlDatabase: QMYSQL driver not loaded
Since my compilation works, I think it has something to do with the linking. I’m using Ubuntu and have installed the driver via apt-get: libqt4-sql-mysql.
Must I recompile Qt from source to include the driver, or should installing the library like I did work?
I’ve added the the necessary cmake code:
- SET(QT_USE_QTSQL TRUE)
- IF(QT_FOUND)
- INCLUDE(${QT_USE_FILE})
- IF(QT_QTSQL_FOUND)
- INCLUDE_DIRECTORIES(${QT_QTSQL_INCLUDE_DIR})
- ELSE(QT_QTSQL_FOUND)
- MESSAGE(FATAL ERROR "Qt SQL libraries missing.")
- ENDIF(QT_QTSQL_FOUND)
- ELSE(QT_FOUND)
- MESSAGE(FATAL ERROR "Qt4 not found.")
- ENDIF(QT_FOUND)
- ADD_EXECUTABLE(BCluster
- ${BC_SOURCES}
- ${BC_WRAP_HEADERS}
- ${BC_WRAP_RESOURCES}
- ${BC_WRAP_UI}
- )
- TARGET_LINK_LIBRARIES(BCluster
- ${QT_LIBRARIES}
- ${QT_QTSQL_LIBRARIES}
- )
2 replies
You must log in to post a reply. Not a member yet? Register here!
