[Qt-interest] CMake + UIC files -- Is this a bug with CMake or with me?
kent williams
nkwmailinglists at gmail.com
Tue Jul 20 19:06:11 CEST 2010
This is with cmake version 2.8.1 on OS X 10.6.
I had a project using CMake and Qt. As long as I only used one QT
Designer-generated .ui file, everything worked perfectly. When I added
as second UI file, things no longer worked. I was working from the
CMake + Qt4 examples on the web.
There are two problems:
1. If you give a list of more than one header file as the dependency
on set_source_files_properties, it throws a configure-time error:
CMake Error at CMakeLists.txt:33 (set_source_files_properties):
set_source_files_properties called with incorrect number of arguments.
2. If I work around that error (by setting each header dependency
individually), then only one of the UI files seems to get processed to
create the corresponding C++ header file:
/scratch/kent/qtcmake/src/QTCMake.cxx:4:35: error:
ui_qvtkpropertydialog.h: No such file or directory
I've put a succinct example illustrating the problem I'm having here:
http://www.cornwarning.com/xfer/QTCmakeTest.tar.gz
The CMakeLists.txt file is as follows:
project(QTCMake)
cmake_minimum_required(VERSION 2.8)
#uses QT4 and associated CMake Macros
find_package( Qt4 REQUIRED )
include(${QT_USE_FILE})
set(QT_USE_QTXML 1)
#dummy test program
set(QTCMake_SRC QTCMake.cxx)
# list of QT Designer-generated XML designs
set(QTCMake_UIS
qvtkpropertydialog.ui qimagetransformdialog.ui
)
#
# this is supposed to wrap all the UI files
QT4_WRAP_UI(UIHeaders ${QTCMake_UIS} )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(QTCMake ${QTCMake_SRC})
if(GUMBY)
#
# unless I misunderstood, this should make the objects
# depend on the headers generated by UIC.
# This doesn't work as it should; I don't know why
set_source_files_properties(${QTCMake_SRC}
PROPERTIES OBJECT_DEPENDS ${UIHeaders})
else()
#
# this loops through the list of ui_*.h, and adds the dependency
# for each.
foreach(hdr ${UIHeaders})
set_source_files_properties(${QTCMake_SRC}
PROPERTIES
OBJECT_DEPENDS ${hdr})
endforeach()
endif()
More information about the Qt-interest-old
mailing list