<br><div class="gmail_quote">2009/3/23 Stephen Collyer <span dir="ltr"><<a href="mailto:scollyer@netspinner.co.uk">scollyer@netspinner.co.uk</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm trying to build a fully static exe on Opensuse 11.1 against a static build of Qt 4.5, and<br>I'm trying to link against a static QMySQL plugin.<br><br>I'm getting a link error when I do so, and I suspect it's because I'm not telling LINK_LIBRARIES how to link against the static plugin<br>
</blockquote></div><br>OK, I've more-or-less sorted this out. I have added the following:<br><br>IF (NOT "${BUILD_SHARED_LIBS}")<br> SET(SQL_LIB_DIRS "${QT_LIBRARY_DIR}/../plugins/sqldrivers" "/usr/lib/mysql")<br>
SET(MYSQL_LIBS qsqlmysql mysqlclient)<br>ENDIF (NOT "${BUILD_SHARED_LIBS}")<br><br>LINK_DIRECTORIES(${QT_LIBRARY_DIR} "../plugins" ${SQL_LIB_DIRS})<br><br>and have changed the exe linking as follows:<br>
<br>SET(PM_SRCS protocol_manager.cpp)<br>ADD_EXECUTABLE(protocol_manager_exe ${PM_SRCS})<br>TARGET_LINK_LIBRARIES(protocol_manager_exe ProtocolManager ClientCertificate Server HTTP IPCListener Comms Exceptions Support ${MYSQL_LIBS} ${QT_LIBRARIES})<br>
<br>However, I'm not entirely happy as:<br><br>a) I've hardcoded the relative path ../plugins/sqldrivers in the SQL_LIB_DIRS<br>b) I've got an explicity reference to /usr/lib as well<br><br>Can anyone suggest how I can make this a bit more platform independent ?<br>
<br>Steve Collyer<br>