Re: [CMake] Mixed linking

2015-02-21 Thread Stephen Kelly
Ray Donnelly wrote:

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

 They should mix fine.

What I meant when I wrote this was 'they should mix fine, but some 
convenience is not available - you need to specify the correct link flags 
yourself'. 

That is, it's 'fine' in the same way that other static libraries which don't 
provide any cmake files at all are 'fine' and leave everything to you.

Thanks,

Steve.


-- 

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

Re: [CMake] Mixed linking

2015-02-21 Thread Ray Donnelly
On Sat, Feb 21, 2015 at 9:59 AM, Stephen Kelly steve...@gmail.com wrote:
 Ray Donnelly wrote:

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

 They should mix fine.

 What I meant when I wrote this was 'they should mix fine, but some
 convenience is not available - you need to specify the correct link flags
 yourself'.

 That is, it's 'fine' in the same way that other static libraries which don't
 provide any cmake files at all are 'fine' and leave everything to you.


Right, thanks Steve. When/if I get time, I might try to make some new
patches for this for Qt5 and CMake that aren't reliant on MSYS2's many
Qt5 patches and test them on OS X and GNU/Linux.

 Thanks,

 Steve.


 --

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

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

Re: [CMake] Mixed linking

2015-02-21 Thread Stephen Kelly
Ghyslain Leclerc wrote:

 Thanks for all the insight.  I have been looking at this and quite a few
 posts (mostly from you !) to try and understand.  I think I get most of
 it.
 
 That being said, I finally got a static executable for my application on
 my mac. What I did is build my application using qmake, get the linker
 command and manually find every library using cmake in order to recreate
 the linker command from qmake (I don’t think it makes a difference, but
 I’m not sure so I even kept the library order the same).

Yes, I think it makes a difference. It also makes a difference whether 
find_library finds the exact same binary which Qt statically links or not. 

The inability to determine which static library (by exact path) is linked by 
the Qt libraries is the reason the Qt5 CMake files don't list the static 
libraries in their INTERFACE_LINK_LIBRARIES. Your find_library calls are not 
a fully generic solution because find_library might find a different binary 
to what Qt is linked to.

 This seems like a lot of work to get what I want…  But if it does the job.
  The fun part will be to see what I need on Windows and then put
 conditionals around that and all.
 
 If I misunderstood something and there is an easier way to get a static
 executable from using static qt from CMake, please let me know.

What I referred to with INTERFACE_SOURCES was just about automatically 
linking in the platform plugin in a static build.  That is provided by Qt, 
so ew know the full path, but we need to generate a file which you compile 
into the executable so that your executable uses a symbol from it. Otherwise 
the linker discards it. So my message was just saying that that part can be 
made simpler.

Thanks,

Steve.


-- 

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

Re: [CMake] Mixed linking

2015-02-10 Thread Ghyslain Leclerc

Stephen Kelly wrote: 
Ah, right the platform plugin issue. This is likely the reason for not 
running on OSX. 

CMake 3.1 learned a new feature specifically so that this would become 
easier in the future: 

http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7970 

qmake generates a file like the above for you and compiles it and links it 
into your application for you in the static version. 

With 

http://www.cmake.org/cmake/help/v3.1/prop_tgt/INTERFACE_SOURCES.html 

Qt can do the same, but someone would have to patch Qt to do so. Something 
for the future... :) 



Thanks for all the insight.  I have been looking at this and quite a few posts 
(mostly from you !) to try and understand.  I think I get most of it.

That being said, I finally got a static executable for my application on my 
mac. What I did is build my application using qmake, get the linker command and 
manually find every library using cmake in order to recreate the linker command 
from qmake (I don’t think it makes a difference, but I’m not sure so I even 
kept the library order the same).  For my application, this is what did it 
ended up with (some boiler plate removed).

find_package( Qt5 COMPONENTS Widgets Sql PrintSupport REQUIRED )

find_library( DISKARBITRATION_LIBRARY DiskArbitration )
find_library( IOKIT_LIBRARY IOKit )
find_library( APPLICATIONSERVICES_LIBRARY ApplicationServices )
find_library( CORESERVICES_LIBRARY CoreServices )
find_library( COREFOUNDATION_LIBRARY CoreFoundation )
find_library( FOUNDATION_LIBRARY Foundation )
find_library( COCOA_LIBRARY Cocoa )
find_library( CARBON_LIBRARY Carbon )

find_library( OPENGL_LIBRARY OpenGL )

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

set( QT_INSTALL_DIR_GL /sw/local/qt/ )
find_library( QCOCOA qcocoa
    PATHS ${QT_INSTALL_DIR_GL}/plugins/platforms )

find_library( QDDS qdds
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QICNS qicns
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QICO qico
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QJP2 qjp2
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QMNG qmng
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QTGA qtga
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QTIFF qtiff
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QWBMP qwbmp
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats )
find_library( QWEBP qwebp
    PATHS ${QT_INSTALL_DIR_GL}/plugins/imageformats” )

# Note, GL are my initials.  It was just to ensure no conflicts in names.  
Probably not necessary


target_link_libraries( calculum
                       ${DISKARBITRATION_LIBRARY}
                       ${IOKIT_LIBRARY}
                       ${APPLICATIONSERVICES_LIBRARY}
                       ${CORESERVICES_LIBRARY}
                       ${COREFOUNDATION_LIBRARY}
                       ${FOUNDATION_LIBRARY}
                       ${COCOA_LIBRARY}
                       ${CARBON_LIBRARY}
                       Qt5::Sql
                       ${QCOCOA}
                       cups
                       /sw/local/qt/lib/libQt5PlatformSupport.a
                       ${OPENGL_LIBRARY}
                       Qt5::PrintSupport
                       Qt5::Widgets
                       ${QDDS}
                       ${QICNS}
                       ${QICO}
                       ${QJP2}
                       ${QMNG}
                       ${QTGA}
                       ${QTIFF}
                       ${QWBMP}
                       ${QWEBP}
                       Qt5::Gui
                       Qt5::Core
                       z
                       m )

This seems like a lot of work to get what I want…  But if it does the job.  The 
fun part will be to see what I need on Windows and then put conditionals around 
that and all.

If I misunderstood something and there is an easier way to get a static 
executable from using static qt from CMake, please let me know.  I am posting 
this in case someone searches for information on how to link static Qt using 
CMake.  The title of my mail said Mixed linking, but it should probably really 
say static linking Qt5 using CMake, but I don’t know how to change it (I have 
seen on the list the formerly was …, but not sure if it’s appropriate or how to 
do it).

Again, thanks for giving a bit of your time.  Really appreciated.

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

[CMake] Mixed linking

2015-02-06 Thread Ray Donnelly
Hi,

Apologies that this won't tread correctly (and for directly CC'ing the
three participants); I only signed up to the mailing list after I saw
this conversation. I'm an MSYS2 developer (and I occasionally hack on
Qt build system issues). I've spent a lot of time working on our qt5
and qt5-static packages and a little time working on our cmake
packages, so I'm quite familiar with the CMake and Qt5 static issues
you are discussing, in fact it's the most recent thing I've hacked on
for these packages. My patches can be found at:

https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-qt5-static
[patches 33 .. 41 are mostly cmake related]
.. and:
https://github.com/Alexpux/MINGW-packages/tree/master/mingw-w64-cmake
[qt5-static-plugin-support.patch]

Stephen Kelly wrote:
 Ghyslain Leclerc wrote:

  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 ?

 They should mix fine.

.. actually, you did submit a patch to Qt5 for this:
https://codereview.qt-project.org/#/c/33193/
.. but then you reverted it:
https://codereview.qt-project.org/#/c/37307/

I un-reverted it for MSYS2, with the logic given in my commit message.
I'll not paste it here as you can read it there, but please correct me
if I'm wrong regarding INTERFACE_LINK_LIBRARIES:
https://github.com/Alexpux/MINGW-packages/commit/fe1c58d6baf5ca98cf6697a41e8e98349a7e81d8

Norbert Pfeiler wrote:
 Currently you have to define »QT_STATIC«

You shouldn't need to do this. If you use MSYS2's
mingw-w64-{i686,x86_64}-qt5-static then that will be defined for you.

 and explicitly include your required plugins in the code to get it working

More on this below.

Norbert Pfeiler wrote:

 For Windows it’s like this:

 #if defined(Q_OS_WIN)  defined(QT_STATIC)
 #include QtPlugin
 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
 #endif

Again, if you use MSYS2's mingw-w64-{i686,x86_64}-cmake then you
should not need to do this either, because of
https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-cmake/qt5-static-plugin-support.patch

Stephen Kelly wrote:

 CMake 3.1 learned a new feature specifically so that this would become
 easier in the future:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7970

 qmake generates a file like the above for you and compiles it and links it
 into your application for you in the static version.

 With

 http://www.cmake.org/cmake/help/v3.1/prop_tgt/INTERFACE_SOURCES.html

 Qt can do the same, but someone would have to patch Qt to do so. Something
 for the future... :)

.. so I guess that overall, my patches are far from ideal (still they
achieve their goal for us!), in particular I didn't like adding code
to cmQtAutoGenerators.cxx as that seems like something that shouldn't
be hard-coded into a general purpose build system, but I'm pleased to
read that the plan is to generalise this kind of thing going forward
(I think that's the gist - clearly I'm no expert in CMake).

As a side node, I actually tried to use a Digia-provided (I think) Qt
static build for something work-related about a year ago, and because
it requires a specific version of the msvc++ runtime I don't think it
fits any useful definition of 'static'. Qt static built with MinGW-w64
does though as the msvcrt.dll we use is present on all Windows
releases all the way back to Windows XP. Maybe I used the wrong one
though, as the Qt SDK seems to be static enough.

Best regards,

Ray Donnelly.
-- 

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

Re: [CMake] Mixed linking

2015-02-06 Thread Norbert Pfeiler

 Norbert Pfeiler wrote:
  Currently you have to define »QT_STATIC«
 You shouldn't need to do this. If you use MSYS2's
 mingw-w64-{i686,x86_64}-qt5-static then that will be defined for you.


I have both *-qt5 (for dev) and *-qt5-static (for deploy) installed and
append the root of qt5-static to CMAKE_PREFIX_PATH for cmake to prefer the
static to the shared version.
QT_STATIC is not defined in this case.

Norbert Pfeiler wrote:
  For Windows it’s like this:
 
  #if defined(Q_OS_WIN)  defined(QT_STATIC)
  #include QtPlugin
  Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
  #endif
 Again, if you use MSYS2's mingw-w64-{i686,x86_64}-cmake then you
 should not need to do this either, because of


This is also not the case in the configuration above.
I don’t have to explicitly link the platform plugin though (after adding
Q_IMPORT_PLUGIN).

These 2 additions are way less of a hassle than having to rename *.lib to
*.a in all the qt cmake files and explicitly specifying all transitive qt
link deps, which was necessary before.
So thanks for your work.

Looking forward to:

  They should mix fine.


Best, Norbert.
-- 

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

Re: [CMake] Mixed linking

2015-02-06 Thread Norbert Pfeiler

 But I just don't know how to include the plugins.  Actually, I always get
 the error about the platform plugin (cocoa in my case).  Any tips ?


For Windows it’s like this:

#if defined(Q_OS_WIN)  defined(QT_STATIC)
#include QtPlugin
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
#endif

Best, Norbert.
-- 

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

Re: [CMake] Mixed linking

2015-02-06 Thread Ghyslain Leclerc
Hello again.  Thanks for the answers.

To Stephen Kelly:

 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 ?

They should mix fine.

Alright, I won't give up just yet.  :-)

 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 :

I recommend starting with a minimal testcase, make sure it runs, and add
things until it doesn't. Find the change that breaks.

Thanks for the suggestion.  Just did.  Here is the code for CMake:

# Some definitions to setup Qt
set( CMAKE_INCLUDE_CURRENT_DIR ON )
set( CMAKE_AUTOMOC ON )
set( QT_STATIC TRUE )
add_definitions( -DQT_STATIC )
if( ${CMAKE_BUILD_TYPE} MATCHES Release )
   add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif()


# Find Qt packages
find_package( Qt5Widgets )

# Find Qt dependencies
find_library( COREFOUNDATION_LIBRARY CoreFoundation )
find_library( COCOA_LIBRARY Cocoa )
find_library( CARBON_LIBRARY Carbon )
find_library( OPENGL_LIBRARY OpenGL )


include_directories( ${CMAKE_CURRENT_LIST_DIR} )
add_executable( helwrld main.cpp )
target_link_libraries( helwrld  Qt5::Widgets ${COREFOUNDATION_LIBRARY}
 ${COCOA_LIBRARY}
 ${CARBON_LIBRARY}
 ${OPENGL_LIBRARY}

/sw/local/qt/lib/libqtharfbuzzng.a
 z )



And here is the main.cpp file


#include QApplication
#include QLabel

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QLabel *label = new QLabel(Hello Qt!);
label-show();
return a.exec();
}

Don't know how to make it simpler.  Using the code compiles and links,
but still won't run.  Maybe my Qt static compilation was missing
something.  I will try and look into that.


To Norbert Pfeiler :

 Currently you have to define ?QT_STATIC? and explicitly include your
 required plugins in the code to get it working.

Thanks for the tips.  I looked up and now define QT_STATIC.  But I
just don't know how to include the plugins.  Actually, I always get
the error about the platform plugin (cocoa in my case).  Any tips ?

Thank you to all !
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


Re: [CMake] Mixed linking

2015-02-06 Thread Stephen Kelly
Norbert Pfeiler wrote:


 But I just don't know how to include the plugins.  Actually, I always get
 the error about the platform plugin (cocoa in my case).  Any tips ?
 
 
 For Windows it’s like this:
 
 #if defined(Q_OS_WIN)  defined(QT_STATIC)
 #include QtPlugin
 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
 #endif

Ah, right the platform plugin issue. This is likely the reason for not 
running on OSX.

CMake 3.1 learned a new feature specifically so that this would become 
easier in the future:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7970

qmake generates a file like the above for you and compiles it and links it 
into your application for you in the static version.

With 

 http://www.cmake.org/cmake/help/v3.1/prop_tgt/INTERFACE_SOURCES.html

Qt can do the same, but someone would have to patch Qt to do so. Something 
for the future... :)

Thanks,

Steve.


-- 

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

Re: [CMake] Mixed linking

2015-02-05 Thread Norbert Pfeiler
Hey,

to build a static qt executable for windows you may be interested in using
msys2.
It offers a prepackaged static qt5 with patches for static linking with
cmake (as the official files are a bit broken for mingw).
Currently you have to define »QT_STATIC« and explicitly include your
required plugins in the code to get it working.
In our case we only link statically on windows, on linux and mac we deploy
the dynamic libraries.

Best, Norbert.
-- 

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

[CMake] Mixed linking

2015-02-05 Thread Ghyslain Leclerc
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

Re: [CMake] Mixed linking

2015-02-05 Thread Stephen Kelly
Ghyslain Leclerc wrote:

 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 ?

They should mix fine.

 
 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 :

I recommend starting with a minimal testcase, make sure it runs, and add 
things until it doesn't. Find the change that breaks. 

 qt5_use_modules( calculum Widgets Sql )

You probably don't need this line.

I don't have experience on OSX to help.

Thanks,

Steve.


-- 

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