Steve,

To be platform independent use FIND_LIBRARY and its HINTS option.
You may want to check CMake/Modules/Find*.cmake files. There are great
examples how to be fully platform independent.

If BUILD_SHARED_LIBS, then ALL libraries in your project will be built
shared. I use for this one separate variable or separate target like:
MyLibraryShared and MyLibraryStatic.

/usr/lib is scanned automatically, you don't need to include it.

If Qt is using MySQL library, you need to include it after Qt, not before.

Denis

 
> 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
> 



      
_______________________________________________
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