MantisBT - CMake
View Issue Details
0012554CMakeCMakepublic2011-11-02 16:402012-05-09 15:26
Pierre-Francois Laquerre 
Clinton Stimpson 
normalminoralways
closedfixed 
64 bit linuxScientific Linux6.1
 
 
0012554: Qt4 macros should quote arguments to shell commands
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.
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"
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.
No tags attached.
patch fix-qt4-macro-path-quoting.patch (3,981) 2011-11-02 16:40
https://public.kitware.com/Bug/file/4108/fix-qt4-macro-path-quoting.patch
Issue History
2011-11-02 16:40Pierre-Francois LaquerreNew Issue
2011-11-02 16:40Pierre-Francois LaquerreFile Added: fix-qt4-macro-path-quoting.patch
2011-11-18 02:32Alex NeundorfAssigned To => Clinton Stimpson
2011-11-18 02:32Alex NeundorfStatusnew => assigned
2011-12-03 19:55Clinton StimpsonNote Added: 0027903
2011-12-03 19:55Clinton StimpsonStatusassigned => resolved
2011-12-03 19:55Clinton StimpsonResolutionopen => fixed
2012-05-09 15:26David ColeNote Added: 0029438
2012-05-09 15:26David ColeStatusresolved => closed

Notes
(0027903)
Clinton Stimpson   
2011-12-03 19:55   
In git repo:
9b07c19 Fix path quoting in Qt4 macros
Thanks for the patch.
(0029438)
David Cole   
2012-05-09 15:26   
Closing resolved issues that have not been updated in more than 4 months.