[CMake] How to embed Qt resources using CMake
Matthew Woehlke
matthew.woehlke at kitware.com
Tue Jul 9 14:24:05 EDT 2013
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 should be the CMakeLists(1|2).txt in this case?
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 to compile into a
static library (containing the resources), then you probably need
Q_INIT_RESOURCE, as you discovered.
--
Matthew
More information about the CMake
mailing list