[Development] Qt's generated cmake files

Stephen Kelly stephen.kelly at kdab.com
Tue Feb 19 08:49:46 CET 2013


On Monday, February 18, 2013 16:03:55 Sascha Cunz wrote:
> > You seem to be doing some things which are not recommended. You shouldn't
> > be starting with finding qmake
> 
> Maybe things changed since I set this up, but I never got this to work
> reliable without appending the cmake_prefix.
> I.e.: On windows I might have installed Qt to X:\Qt5\bin - how would cmake
> know that I installed Qt there, unless I append the prefix path?

Generally, you set the CMAKE_PREFIX_PATH environment variable to contain the 
path X:\Qt5. How is it finding qmake? Did you put X:\Qt5\bin in the PATH?

> 
> Considering the smallness of most of my projects, when something goes wrong
> that is not easily explained, "probably caused by invalid build" or when
> switching platforms, i tend to completely remove my build directory and do a
> fresh cmake run followed by a full build. As I don't want to populate the
> cache every time, I settled on searching for qmake in $path and append the
> cmake_prefix_path with qt's install path.
> 
> Isn't this a valid approach? What would be better yet still that simple?

Set the environment variable, or create a wrapper script. I use a small script 
which is called cmakekde for historical reasons, which does something like 

 cd $builddir && cmake $srcdir -DCMAKE_PREFIX_PATH=$PREFIX \
                               -DCMAKE_INSTALL_PREFIX=$PREFIX \
                               -DCMAKE_BUILD_TYPE=debug

The $PREFIX is managed by another script so that I have different prefixes for 
different Qt versions and branches.

Thanks,

-- 
Stephen Kelly <stephen.kelly at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130219/e4783f1c/attachment.sig>


More information about the Development mailing list