[cmake-developers] [CMake 0011957]: qt4_wrap_cpp command slows down configuration

Mantis Bug Tracker mantis at public.kitware.com
Thu Mar 10 06:17:15 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=11957 
====================================================================== 
Reported By:                A. Saratow
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11957
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   low
Status:                     new
====================================================================== 
Date Submitted:             2011-03-10 06:17 EST
Last Modified:              2011-03-10 06:17 EST
====================================================================== 
Summary:                    qt4_wrap_cpp command slows down configuration
Description: 
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)


Steps to Reproduce: 
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.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-03-10 06:17 A. Saratow     New Issue                                    
======================================================================




More information about the cmake-developers mailing list