Hello,

My apologies for the long post, but I think context helps a little.

We have a set of applications (4 at the moment) which compile against ITK, VTK, 
DCMTK and Boost.  All of those things are compiled statically.  So is the 
application.  We are developing on Windows, OS X and Linux boxes, but deploying 
almost only on Windows, so the cross-platform quality of the libraries is 
important to us and CMake makes it relatively easy to target all those platform.

Without going into static vs dynamic territory, I’ll say that our choice is 
based on ease of deployment to the hospital network where IT has lots of 
control, but we do not.  So far, because of our choice of static linking, 
deployment is basically renaming the old .exe to keep an archive of all 
software that has been run clinical, and then put the new executable in place.

We’ve come to the stage where a GUI is something that would be practical.  We 
have decided to go with Qt.  We would like, if possible, to keep using static 
linking as a strategy, but as far as I can tell, trying to figure out how to 
use the new Qt5 macros, static linking of Qt is not exactly supported by CMake.

Here are a few questions for the list (hoping someone more knowledgable than me 
will read this and help):

1) Am I right when I say CMake, Qt and static linking don’t mix ?

I have tried on OS X.   I have compiled a static version of Qt, making sure I 
explicitly enable every plugin I need.  Then, I have used the following CMake 
code :
    find_package( Qt5Widgets )
    find_package( Qt5Sql )

    find_library( COREFOUNDATION_LIBRARY CoreFoundation )
    find_library( COCOA_LIBRARY Cocoa )
    find_library( CARBON_LIBRARY Carbon )
    find_library( WEBKIT_LIBRARY WebKit )
    find_library( IOKIT_LIBRARY IOKit )
    find_library( OPENGL_LIBRARY OpenGL )

    set( CMAKE_INCLUDE_CURRENT_DIR ON )
    set( CMAKE_AUTOMOC ON )

    add_executable( calculum ${SRCS_LIST} ${UIS_LIST} ${HDRS_LIST} )

    target_link_libraries( calculum ${COREFOUNDATION_LIBRARY} ${COCOA_LIBRARY}
                                    ${OPENGL_LIBRARY} ${CARBON_LIBRARY}
                                    Qt5::Widgets Qt5::Sql 
"/sw/local/qt/plugins/platforms/libqcocoa.a" 
                                    "/sw/local/qt/lib/libqtharfbuzzng.a" z )

    qt5_use_modules( calculum Widgets Sql )
Even so, the executable won’t run.  I have then tried using the 
BundleUtilities, but that still won’t work (although I am still figuring things 
out, so it might be misunderstanding on my part that’s the culprit)


2) If so, we will have to switch to dynamic linking for our GUI applications.  
In that case, is there a way to keep statically linking our other libraries 
(ITK, VTK, etc.) into our application and only dynamically link the Qt stuff ?  
If we can’t, it means we’ll have to create dynamic libraries of all our 
external libraries and link to them.  Deployment will be much harder for us, 
given that we have zero experience with that.

Can you point me towards some tutorials (or documentation, but sometimes, 
documentation only gets you so far without examples…) ?

Thanks
Ghyslain





-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to