MantisBT - CMake
View Issue Details
0011957CMakeCMakepublic2011-03-10 06:172011-09-05 11:37
A. Saratow 
Clinton Stimpson 
lowminoralways
closedfixed 
WIN32XP
CMake 2.8.4 
 
0011957: qt4_wrap_cpp command slows down configuration
Usage of the qt4_wrap_cpp command may slow down the configuration process on Win32 systems significantly if there are many options to be written to MOC parameter files (e.g. many include paths or defines, caused by inclusion of large frameworks like DCMTK or VTK).

The reason is that for WIN32 systems each parameter is appended to a parameter file using a FILE(APPEND "...\n" ) call, which is probably not an optimal solution. See QT4_CREATE_MOC_COMMAND macro in Qt4Macros.cmake:110 - Qt4Macros.cmake:113.

Following change seems to significantly improve the performance of CMake configuration runs:

      SET (_moc_parameters_file ${outfile}_parameters)
      SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}" "${infile}")
< FILE (REMOVE ${_moc_parameters_file})
< FOREACH(arg ${_moc_parameters})
< FILE (APPEND ${_moc_parameters_file} "${arg}\n")
< ENDFOREACH(arg)
---
> STRING (REPLACE ";" "\n" _moc_parameters "${_moc_parameters}")
> FILE (WRITE ${_moc_parameters_file} "${_moc_parameters}")
      ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
                         COMMAND ${QT_MOC_EXECUTABLE} @${_moc_outfile_name}_parameters
                         DEPENDS ${infile}
                         ${_moc_working_dir}
                         VERBATIM)
The easiest way to reproduce this problem would be to fetch a large CMake-configured project with many QObject-derived classes, include the VTK framework and try to configure the project.

For small example projects this issue is not really noticeable.
No tags attached.
Issue History
2011-03-10 06:17A. SaratowNew Issue
2011-03-10 07:28Brad KingAssigned To => Clinton Stimpson
2011-03-10 07:28Brad KingStatusnew => assigned
2011-03-10 16:47Clinton StimpsonNote Added: 0025753
2011-03-10 16:47Clinton StimpsonStatusassigned => resolved
2011-03-10 16:47Clinton StimpsonResolutionopen => fixed
2011-09-05 11:37David ColeStatusresolved => closed
2011-09-05 11:37David ColeNote Added: 0027337

Notes
(0025753)
Clinton Stimpson   
2011-03-10 16:47   
Thanks.
http://cmake.org/gitweb?p=cmake.git;a=commit;h=ae587e [^]
(0027337)
David Cole   
2011-09-05 11:37   
Closing resolved issues that have not been updated in more than 4 months.