[Cmake] change in behaviour of QT_WRAP_CPP

Ian Scott ian . m . scott at stud . man . ac . uk
Fri, 31 Oct 2003 11:21:46 -0000


Hi,

There appears to have been a change in the behaviour of QT_WRAP_CPP between
1.6.7 and 1.8.1. QT_WRAP_CPP now adds its .h files to the library/executable
file list. It did not do that in 1.6.7 and before. Is this a deliberate
change in behaviour. It isn't mentioned in the documentation, and it breaks
compatibility with old CMakeLists.txt files. It can be got around with a
simple change to the CMakeLists.txt files, but I'd be grateful to know if it
is a deliberate permanent change?


Details:

In the following example (which ran happily under CMake1.6.7)
PROJECT(qtest)

INCLUDE (${CMAKE_ROOT}/Modules/FindQT.cmake)
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
SET(qtest_sources
    qtest_pane.h qtest_pane.cxx )

SET(qtest_moc_classes
    qtest_pane.h )

QT_WRAP_CPP(qtest qtest_moc_files ${qtest_moc_classes})
ADD_LIBRARY(qtest ${qtest_sources} ${qtest_moc_files})
TARGET_LINK_LIBRARIES(qtest  ${QT_LIBRARIES} )

qtest_pane.h is now added twice to the source files list for the library
qtest. This is no problem under UNIX, but causes MSVC6.0 to barf that it has
two candidates for the creation of moc_qtest_paine.cxx. The problem occurs
in both CMake 1.8.1 and the CVS HEAD. The fix is to remove the qtest_pane.h
from qtest_sources. However before we fix our hundred or so CMakeLists.txt
files that are affected, we like to know that the change is permanent. I
can't find any reference in the list archives. For what its worth, we
believe the old behaviour to be superior. The SET(qtest_sources ...) bit of
the CMakeLists.txt file looks more like that of a non QT library.

Many thanks,
Ian Scott.