[CMake] Error in generated nmake files on Windows

Alexander Neundorf a.neundorf-work at gmx.net
Mon May 24 15:47:46 EDT 2010


On Monday 24 May 2010, Michael Hertling wrote:
> On 05/24/2010 03:42 PM, Michael Wild wrote:
> > On 24. May, 2010, at 15:24 , Bo Thorsen wrote:
> >> Hi all,
> >>
> >> I have as simple a CMakeLists.txt as possible:
> >>
> >> ADD_EXECUTABLE(comp_err comp_err.c)
> >>
> >> I did these two commands:
> >>
> >> $ set CMAKE_BUILD_TYPE=RelWithDebInfo
> >> $ cmake -G "NMake Makefiles"
> >>
> >> I got this:
> >>
> >> Building C object extra/CMakeFiles/comp_err.dir/comp_err.c.obj
> >> comp_err.c
> >> Linking C executable comp_err.exe
> >> LINK : fatal error LNK1146: no argument specified with option
> >> '/machine:' LINK failed. with 2
> >> NMAKE : fatal error U1077: '"C:\Program Files (x86)\CMake
> >> 2.8\bin\cmake.exe"' : return code '0xffffffff' Stop.
> >> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
> >> Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2' Stop.
> >> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
> >> Studio 9.0\VC\BIN\nmake.exe"' : return code '0x2' Stop.
> >>
> >> Is it something I'm doing wrong, or should I report a bug on this?
> >>
> >> I'm on a 64 bit Windows 7 with Visual C++ 2008 Express Edition.
> >>
> >> Bo.
> >
> > Is it really just this single line or are you eliding the PROJECT
> > command? That one is required for anything to work....
>
> On *nix, that minimal CMakeLists.txt succeeds without an error or a
> warning w.r.t. the missing PROJECT(), and the subsequent build - with
> *nix Make, of course - succeeds, too, provided that comp_err.c contains
> "main()". Is the PROJECT() really necessary for that to work on Windows?

No.
If there is no project() command in the toplevel CMakeLists.txt, cmake 
automatically inserts one internally, i.e. there is never a buildtree without 
project() call.

Alex


More information about the CMake mailing list