[cmake-developers] [CMake 0012554]: Qt4 macros should quote arguments to shell commands

Mantis Bug Tracker mantis at public.kitware.com
Wed Nov 2 16:40:28 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=12554 
====================================================================== 
Reported By:                Pierre-Francois Laquerre
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12554
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-11-02 16:40 EDT
Last Modified:              2011-11-02 16:40 EDT
====================================================================== 
Summary:                    Qt4 macros should quote arguments to shell commands
Description: 
The macros in Modules/Qt4Macros.cmake do not properly quote their arguments when
calling external commands through ADD_CUSTOM_COMMAND. This leads to issues when
building projects with files whose name contains spaces or parentheses.

Adding VERBATIM to ADD_CUSTOM_COMMAND fixes this issue.


Steps to Reproduce: 
1) Call any of the following macros when building a project in /tmp/foo(bar)/:
QT4_CREATE_MOC_COMMAND (only on non-WIN32), QT4_WRAP_UI, QT4_ADD_RESOURCES,
QT4_ADD_DBUS_INTERFACE, QT4_GENERATE_INTERFACE, QT4_ADD_DBUS_ADAPTOR,
QT4_CREATE_TRANSLATION, QT4_ADD_TRANSLATION.

Expected behaviour: whatever these macros are supposed to do
Current behaviour: failure at the shell level, e.g.

> cd "/tmp/test(foo)/build.rel/qtlua/qlua" && /usr/lib64/qt4/bin/rcc -name qlua
-o /tmp/test(foo)/build.rel/qtlua/qlua/qrc_qlua.cxx
/tmp/test(foo)/qtlua/qlua/qlua.qrc
> /bin/sh: -c: line 0: syntax error near unexpected token `('
> /bin/sh: -c: line 0: `cd "/tmp/test(foo)/build.rel/qtlua/qlua" &&
/usr/lib64/qt4/bin/rcc -name qlua -o
/tmp/test(foo)/build.rel/qtlua/qlua/qrc_qlua.cxx
/tmp/test(foo)/qtlua/qlua/qlua.qrc'
> make[2]: *** [qtlua/qlua/qrc_qlua.cxx] Error 1
> make[2]: Leaving directory `/tmp/test(foo)/build.rel'
> make[1]: *** [qtlua/qlua/CMakeFiles/libqlua.dir/all] Error 2
> make[1]: Leaving directory `/tmp/test(foo)/build.rel'
> make: *** [all] Error 2

whereas the proper command should have been (notice the quotes):

> cd "/tmp/test(foo)/build.rel/qtlua/qlua" && /usr/lib64/qt4/bin/rcc -name
"qlua" -o "/tmp/test(foo)/build.rel/qtlua/qlua/qrc_qlua.cxx"
"/tmp/test(foo)/qtlua/qlua/qlua.qrc"


Additional Information: 
Related mailing post:
http://www.cmake.org/pipermail/cmake/2011-October/047101.html. Adding VERBATIM
to the ADD_CUSTOM_COMMAND calls fixes this. Patch included.

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-11-02 16:40 Pierre-Francois LaquerreNew Issue                              
     
2011-11-02 16:40 Pierre-Francois LaquerreFile Added:
fix-qt4-macro-path-quoting.patch                    
======================================================================




More information about the cmake-developers mailing list