Hi folks,
I am using out-of-tree builds with Trojita [1], a Qt application. My cmake
version is 2.8.10.2 on Gentoo Linux using the default Makefile generator and
GNU make.
Some of my .cpp files #include "ui_something.h", which are generated by moc.
Other files are imported from 3rd party projects and directly include moc_*.cpp. In order
to make this work, my code calls:
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_AUTOMOC True)
However, it looks that due to a fix for #13494 [2], moc gets re-run whenever I run
`make`. The build system is apparently smart enough to not re-link everything, but it
nonetheless takes at least 3.5 seconds of real time when using non-parallel builds (and
1.7 seconds when building with -j6, which I sometimes cannot use because I have
"only" 4GB of RAM on this machine, Thinkpad T420s with i5-2520M and an Intel
SSD).
I guess what I'm looking for is a way of telling cmake to add
-I${CMAKE_CURRENT_BINARY_DIR} only when calling the actual compiler, not moc.
Is that possible? Or shall I do it some other way?
I guess that I could probably split the static library I'm building into two
units, one for the generated files and the other for actual sources, and set
the include directory only when building the second library (via
target-specific properties). I'm not sure how easy it is to persuade automoc to
work in such a setup, though.
Another annoyance is that I want to support cmake 2.8.7 as well (that's what
gets shipped with Ubuntu 12.04 LTS) which does not support target-specific
includes. My cmake setup is annoyingly complicated due to this requirement
already, and I'd like to keep it in a maintaineable state :). General comments
on the readability of the existing cmake setup are much appreciated as well --
perhaps I'm doing something in a completely wrong way, after all.
With kind regards,
Jan
[1]
http://quickgit.kde.org/?p=trojita.git&a=blob&h=4ac8397d028bec11e636affc72c2c014e8b8e756&hb=b870be05017674781bc52c48934c9800a6329493&f=CMakeLists.txt
[2] http://public.kitware.com/Bug/view.php?id=13494
--
Trojitá, a fast Qt IMAP e-mail client -- http://trojita.flaska.net/
--
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://www.cmake.org/mailman/listinfo/cmake