[CMake] nmake, automoc and cmake problem

Alexander Neundorf a.neundorf-work at gmx.net
Wed Oct 1 19:09:31 EDT 2008


On Friday 19 September 2008, Boudewijn Rempt wrote:
> On Fri, 19 Sep 2008, Boudewijn Rempt wrote:
> > Hi,
> >
> > We're having a little problem when trying to compile a Qt-based library
> > (libiris) using nmake. We're using cmake 2.6 and automoc, but running
> > nmake results in:
> >
> > C:\WORK\HyvesDesktop\trunk\build>nmake
> >
> > Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
> > Copyright (C) Microsoft Corporation.  All rights reserved.
> >
> > Error: syntax error in C:.files
> > NMAKE : fatal error U1077: '"C:\Program Files\CMake
> > 2.6\bin\automoc4.exe"' : return code '0x1' Stop.
> > NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> > 9.0\VC\BIN\nmake.exe"' : return code '0x2' Stop.
> > NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
> > 9.0\VC\BIN\nmake.exe"' : return code '0x2' Stop.
> >
> > This command is generated:
> >
> >     "C:\Program Files\CMake 2.6\bin\automoc4.exe"
> > C:/WORK/HyvesDesktop/trunk/build/3rdparty/iris/iris_automoc.cpp
> > C:/WORK/HyvesDesktop/trunk/3rdparty/iris
> > C:/WORK/HyvesDesktop/trunk/build/3rdparty/iris C:/qt45/bin/moc.exe
> > "C:/Program Files/CMake 2.6/bin/cmake.exe"
> >
> > Either converting all forward slashes to backward slashes or adding
> > quotas around the arguments fixes the build. Is this likely to be a bug
> > in cmake or the automoc macros, or are we doing something wrong?
>
> To follow up -- while putting quotes around the arguments generated by
> the automoc's custom command or replacing the / by \ works, actually
> moving CMake out of Program Files to c:\cmake26 also solves the build
> problem.

So the problem is that cmake is in a directory with a space ?
Damn, all my source and build trees have spaces, but not my install locations, 
so I missed this one :-/
I don't have any Windows here, so I can't test.
The problem seems to be that cmake is in a dir with a space. Then automoc4 
does:
...
void AutoMoc::lazyInit()
{
    const QStringList &args = QCoreApplication::arguments();
    mocExe = args[4];
    cmakeExecutable = args[5];

and in Automoc4Config.cmake is 
      add_custom_command(OUTPUT ${_automoc_source}
         COMMAND ${AUTOMOC4_EXECUTABLE}
         ${_automoc_source}
         ${CMAKE_CURRENT_SOURCE_DIR}
         ${CMAKE_CURRENT_BINARY_DIR}
         ${QT_MOC_EXECUTABLE}
         ${CMAKE_COMMAND}
         --touch
...

I'd say that automoc4 in your case gets "C:/Program Files/CMake" as args[5], 
which is not executable ;-)
Can you please check whether putting quotes around ${CMAKE_COMMAND} in 
Automoc4Config.cmake fixes this for you ? Escaped quotes ?

Alex


More information about the CMake mailing list