2009/3/23 Stephen Collyer <[email protected]>

> I'm trying to build a fully static exe on Opensuse 11.1 against a static
> build of Qt 4.5, and
> I'm trying to link against a static QMySQL plugin.
>
> 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
>

OK, I've more-or-less sorted this out. I have added the following:

IF (NOT "${BUILD_SHARED_LIBS}")
    SET(SQL_LIB_DIRS "${QT_LIBRARY_DIR}/../plugins/sqldrivers"
"/usr/lib/mysql")
    SET(MYSQL_LIBS qsqlmysql mysqlclient)
ENDIF (NOT "${BUILD_SHARED_LIBS}")

LINK_DIRECTORIES(${QT_LIBRARY_DIR} "../plugins" ${SQL_LIB_DIRS})

and have changed the exe linking as follows:

SET(PM_SRCS protocol_manager.cpp)
ADD_EXECUTABLE(protocol_manager_exe ${PM_SRCS})
TARGET_LINK_LIBRARIES(protocol_manager_exe ProtocolManager ClientCertificate
Server HTTP IPCListener Comms Exceptions Support ${MYSQL_LIBS}
${QT_LIBRARIES})

However, I'm not entirely happy as:

a) I've hardcoded the relative path ../plugins/sqldrivers in the
SQL_LIB_DIRS
b) I've got an explicity reference to /usr/lib as well

Can anyone suggest how I can make this a bit more platform independent ?

Steve Collyer
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to