[CMake] CMake + UIC files -- Is this a bug with CMake or with me?

Andreas Pakulat apaku at gmx.de
Tue Jul 20 17:07:45 EDT 2010


On 20.07.10 15:43:16, kent williams wrote:
> I see what you're doing and I have two points:
> 
> 1. You only have one file in ${${PROJECT_HAME}_UIS} -- what happens if
> you create a second file with Designer and add it to this project?
> Believe me, I read through Qt4Macros.cmake, and what's there should
> work, but in my case it most definitely does not.

I've adjusted your CMakeLists.txt to use

set_source_files_properties(${QTCMake_SRC} PROPERTIES OBJECT_DEPENDS
"${UIHeaders}")

The generated Makefiles do generate the headers from the ui files before
building the object file for the executable. So this does work as long
as you're using quotes around the variable. It also works that after
touching a .ui file the header gets re-generated. (I'm using CMake 2.8.1
currently here).

> 2. I don't get adding '*.h' files to the source list in add_executable
> does anything.  It doesn't apparently generate a recipe to make an
> object file from a header.

It does make sure that _something_ depends on the generated header
files. This then triggers generating them from the .ui file. I think
thats the problem with your original example, there's nothing (in
particular no target) that depends explicitly on the generated header
files and hence the "all" target doesn't generate them.

This is pretty similar to your approach with
set_source_files_properties, except its a bit more hidden whats going on
and the dependency is probably between the target and the header.

Andreas

-- 
Expect a letter from a friend who will ask a favor of you.


More information about the CMake mailing list