[CMake] Link error when building static exe against static Qt 4.5 plugin
Stephen Collyer
scollyer at netspinner.co.uk
Mon Mar 23 12:53:15 EDT 2009
2009/3/23 Stephen Collyer <scollyer at netspinner.co.uk>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090323/e23ada23/attachment.htm>
More information about the CMake
mailing list