<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Hello,</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">My apologies for the long post, but I think context helps a little.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">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.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">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.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">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.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Here are a few questions for the list (hoping someone more knowledgable than me will read this and help):</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">1) Am I right when I say CMake, Qt and static linking don’t mix ?</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">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 :</div><div id="bloop_customfont" style="margin: 0px;"><div id="bloop_customfont" style="margin: 0px;">    find_package( Qt5Widgets )</div><div id="bloop_customfont" style="margin: 0px;">    find_package( Qt5Sql )</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;"><div id="bloop_customfont" style="margin: 0px;">    find_library( COREFOUNDATION_LIBRARY CoreFoundation )</div><div id="bloop_customfont" style="margin: 0px;">    find_library( COCOA_LIBRARY Cocoa )</div><div id="bloop_customfont" style="margin: 0px;">    find_library( CARBON_LIBRARY Carbon )</div><div id="bloop_customfont" style="margin: 0px;">    find_library( WEBKIT_LIBRARY WebKit )</div><div id="bloop_customfont" style="margin: 0px;">    find_library( IOKIT_LIBRARY IOKit )</div><div id="bloop_customfont" style="margin: 0px;">    find_library( OPENGL_LIBRARY OpenGL )</div></div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;"><div id="bloop_customfont" style="margin: 0px;">    set( CMAKE_INCLUDE_CURRENT_DIR ON )</div><div id="bloop_customfont" style="margin: 0px;">    set( CMAKE_AUTOMOC ON )</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">    add_executable( calculum ${SRCS_LIST} ${UIS_LIST} ${HDRS_LIST} )</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;"><div id="bloop_customfont" style="margin: 0px;">    target_link_libraries( calculum ${COREFOUNDATION_LIBRARY} ${COCOA_LIBRARY}</div><div id="bloop_customfont" style="margin: 0px;">                                    ${OPENGL_LIBRARY} ${CARBON_LIBRARY}</div><div id="bloop_customfont" style="margin: 0px;">                                    Qt5::Widgets Qt5::Sql "/sw/local/qt/plugins/platforms/libqcocoa.a" </div><div id="bloop_customfont" style="margin: 0px;">                                    "/sw/local/qt/lib/libqtharfbuzzng.a" z )</div><div id="bloop_customfont" style="margin: 0px;"><br></div><div id="bloop_customfont" style="margin: 0px;">    qt5_use_modules( calculum Widgets Sql )</div></div></div></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">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)</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">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.</div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><br></div><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;">Can you point me towards some tutorials (or documentation, but sometimes, documentation only gets you so far without examples…) ?</div><div id="bloop_sign_1423163985726296064" class="bloop_sign"></div><div id="bloop_sign_1423163985726296064" class="bloop_sign"><br></div><div id="bloop_sign_1423163985726296064" class="bloop_sign">Thanks</div><div id="bloop_sign_1423163985726296064" class="bloop_sign">Ghyslain</div><div id="bloop_sign_1423163985726296064" class="bloop_sign"><br></div><div id="bloop_sign_1423163985726296064" class="bloop_sign"><br></div><div id="bloop_sign_1423163985726296064" class="bloop_sign"><br></div><div id="bloop_sign_1423163985726296064" class="bloop_sign"><br></div><div id="bloop_sign_1423163985726296064" class="bloop_sign"><br></div></body></html>