[CMake] cmake 2.8.5 qt4 macros and file names with parentheses

Clinton Stimpson clinton at elemtech.com
Mon Oct 31 18:29:52 EDT 2011


On Monday, October 31, 2011 02:39:16 pm Pierre-Francois Laquerre wrote:
> Short version: shouldn't the macros in Modules/Qt4Macros.cmake call
> ADD_CUSTOM_COMMAND with VERBATIM?

Yes, it looks like it should.  Can you add a bug in the bug tracker?

Thanks,
Clint

> 
> Long version:
> 
> I'm trying to build
> https://github.com/pflaquerre/torch/tree/build-under-path-with-parentheses
> with cmake 2.8.5. It works fine when building in, say, /tmp/test/, but
> 
> not in /tmp/test(foo):
> > 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
> 
> The issue is obviously the lack of quotes around the paths, but I'm
> not sure what is causing it. One of the offending cmake files is
> https://github.com/pflaquerre/torch/blob/build-under-path-with-parentheses/
> qtlua/qlua/CMakeLists.txt, which calls MACRO_QT4_AUTOGEN from
> https://github.com/pflaquerre/torch/blob/build-under-path-with-parentheses/
> qtlua/cmake/MacroQt4AutoGen.cmake, which in turn calls the cmake macros
> QT4_WRAP_UI, QT4_ADD_RESOURCES, QT4_WRAP_CPP and QT4_GENERATE_MOC.
> However, it doesn't seem like those cmake files are doing anything wrong
> as far as quoting goes. I had a look at the latest Modules/Qt4Macros.cmake
> on github and noticed that there are a few places where 
ADD_CUSTOM_COMMAND
> is not called with VERBATIM. For instance, QT4_CREATE_MOC_COMMAND only
> uses VERBATIM on
> 
> WIN32:
> > MACRO (QT4_CREATE_MOC_COMMAND infile outfile moc_flags moc_options)
> >
> >  # For Windows, create a parameters file to work around command line
> >length limit IF (WIN32)
> >    # Pass the parameters in a file.  Set the working directory to
> >    # be that containing the parameters file and reference it by
> >    # just the file name.  This is necessary because the moc tool on
> >    # MinGW builds does not seem to handle spaces in the path to the
> >    # file given with the @ syntax.
> >    GET_FILENAME_COMPONENT(_moc_outfile_name "${outfile}" NAME)
> >    GET_FILENAME_COMPONENT(_moc_outfile_dir "${outfile}" PATH)
> >    IF(_moc_outfile_dir)
> >      SET(_moc_working_dir WORKING_DIRECTORY ${_moc_outfile_dir})
> >    ENDIF(_moc_outfile_dir)
> >    SET (_moc_parameters_file ${outfile}_parameters)
> >    SET (_moc_parameters ${moc_flags} ${moc_options} -o "${outfile}"
> >"${infile}") 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)
> >  ELSE (WIN32)
> >    ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
> >                       COMMAND ${QT_MOC_EXECUTABLE}
> >                       ARGS ${moc_flags} ${moc_options} -o ${outfile}
> >${infile} DEPENDS ${infile})
> >  ENDIF (WIN32)
> >
> > ENDMACRO (QT4_CREATE_MOC_COMMAND)
> 
> Is this on purpose? Adding VERBATIM to the ADD_CUSTOM_COMMAND calls in
> that file solved the quoting issue and allowed me to build without any
> problems. Is that project just misusing cmake, or is it really a
> problem with Qt4Macros.cmake?
> 
> Regards,
> 
> Pierre-Francois
> --
> 
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake

-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com


More information about the CMake mailing list