Re: [CMake] How to embed Qt resources using CMake

2013-07-09 Thread Matthew Woehlke
On 2013-07-09 14:46, Júlio Hoffimann wrote: One last question, is it portable to use ../ links in CMake? Or you just typed it for fast illustration? I use "../" all over the place... all that is required is a correct absolute or relative path to the .qrc (or whatever other source file). (Rel

Re: [CMake] How to embed Qt resources using CMake

2013-07-09 Thread Pau Garcia i Quiles
Hello, It is portable, as long as ".." still does lead you to the right directory. That's why I prefer variables and fully-identified paths: I can move stuff around and don't have to worry about "..", "../..", "../../resources", etc still being true. On Tue, Jul 9, 2013 at 8:46 PM, Júlio Hoffima

Re: [CMake] How to embed Qt resources using CMake

2013-07-09 Thread Júlio Hoffimann
Matthew, One last question, is it portable to use ../ links in CMake? Or you just typed it for fast illustration? Best, Júlio. -- 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 th

Re: [CMake] How to embed Qt resources using CMake

2013-07-09 Thread Júlio Hoffimann
> Our project tree looks roughly like this, but we don't have a > CMakeLists.txt in what corresponds to your 'main'; we just do > (exe/CMakeLists.txt): > > qt4_add_resources(resSources ../main/icons.qrc) > add_executable(... ${resSources}) > > If you also have sources in 'main' that you are trying

Re: [CMake] How to embed Qt resources using CMake

2013-07-09 Thread Matthew Woehlke
On 2013-07-08 12:59, Júlio Hoffimann wrote: My CMakeLists.txt resides at the same directory as icons.qrc, but my main application is linked in a completely separate folder: main/ -- resources/ -- -- pixmaps/ -- CMakeLists1.txt -- icons.qrc exe/ -- CMakeLists2.txt -- main.cpp Is it okay? What sh

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Júlio Hoffimann
I guess the problem is related to static linkage. I'm actually building static libraries and it seems in that case the resource files are optimized out by the compiler. I tried to build shared libraries, but for the moment I have to fix strongly connected components before doing it. A possible sol

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Júlio Hoffimann
I'm doing exactly this you have shown. A CMakeLists.txt at the top level and various subdirs (subprojects). I must read more about Qt resources for solving the issue, it's really my lack of experience on this topic that is causing the icons to be missed during runtime. Best, Júlio. -- Powered by

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Pau Garcia i Quiles
Hello, How do you call invoke CMakeLists1.txt and CMakeLists2.txt? If you want to keep separate CMakeLists.txt, I would do something like this: main/ CMakeLists.txt -- resources/ -- -- pixmaps/ -- CMakeLists1.txt -- icons.qrc exe/ -- CMakeLists2.txt -- main.cpp Where CMakeLists.txt is something

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Júlio Hoffimann
My CMakeLists.txt resides at the same directory as icons.qrc, but my main application is linked in a completely separate folder: main/ -- resources/ -- -- pixmaps/ -- CMakeLists1.txt -- icons.qrc exe/ -- CMakeLists2.txt -- main.cpp Is it okay? What should be the CMakeLists(1|2).txt in this case?

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Pau Garcia i Quiles
Hello, Files put in a resource file are converted to base64, then compiled in the executable/library. That's why CMake (and qmake) add the result of the qrc "compilation" to the source files. >From what you say, it looks like icons.qrc is not in the same directory your CMakeLists.txt is. Make sur

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Júlio Hoffimann
Pau, I did exactly that, I think the issue is with the file paths not with my CMakeLists.txt. What Qt does with resource files exactly? Is it a runtime load? The paths must be relative to the linked executable? Also, where I can find the complete specification for that XML in icons.qrc? Bogdan,

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Bogdan Cristea
The paths should be relative to the folder where your qrc file reside. Then you can use QT4_ADD_RESOURCES(lib_resources icons.qrc) add_library(mylib ${lib_srcs} ${lib_resources}) On 08.07.2013 18:17, Júlio Hoffimann wrote: Dear all, I'm not that experienced with Qt, but I'm migrating an exis

Re: [CMake] How to embed Qt resources using CMake

2013-07-08 Thread Pau Garcia i Quiles
Hello, That's not how Qt4 resources are added with CMake. Here you have a good explanation: http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake On Mon, Jul 8, 2013 at 6:17 PM, Júlio Hoffimann wrote: > Dear all, > > I'm not that experienced with Qt, but I'm migrating an e

[CMake] How to embed Qt resources using CMake

2013-07-08 Thread Júlio Hoffimann
Dear all, I'm not that experienced with Qt, but I'm migrating an existing application to use CMake as the build system. It all worked smoothly, except the icons in the GUI aren't being shown. Suppose I'm a directory named main/ that has a subdirectory named resources/pixmaps: main/ -- resources/