FYI: On Linux (using CMake v2.8.8 and a recent Ninja), the Ninja build works as expected. Just like it used to do on Windows. I now suspect the problem is related to the CMake version I use (cmake version 2.8.8.20120605). I picked it up somewhere I don't recall and that's probably the cause of the problem. I'll try downloading the most recent binary pre-release and see if that doesn't fix the problem.<div>
<br></div><div>If so, I apologize for any wasted time.</div><div><br></div><div><br></div><div>Cheers,</div><div>Mikael<br><div><br></div><div><div class="gmail_quote">2012/6/27 David Cole <span dir="ltr"><<a href="mailto:david.cole@kitware.com" target="_blank">david.cole@kitware.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Jun 26, 2012 at 6:40 PM, Mikael Lyngvig <<a href="mailto:mikael@lyngvig.org">mikael@lyngvig.org</a>> wrote:<br>
> Ohh, sorry. Ninja says:<br>
><br>
> [117/325] Building CXX object Driver/CMakeFiles/Driver.dir/Driver.cpp.obj<br>
> FAILED: c:\Mingw64\bin\c++.exe -DNDEBUG<br>
> -DBR0_BUILD_ASSERT=BR0_BUILD_ASSERT_DELETE<br>
> -DBR0_BUILD_CHARSET=BR0_BUILD_CHARSET_ASCII<br>
> -DBR0_BUILD_ENDIAN=BR0_BUILD_ENDIAN_LITTLE<br>
> -DBR0_BUILD_MODE=BR0_BUILD_MODE_SHIP<br>
> -DBR0_BUILD_TARGET=BR0_BUILD_TARGET_WINDOWS -Wall -Wno-long-long -pedantic<br>
> -I.. -Ic:/Synology/clang-3.2-WIN64/include -static-libgcc -MMD -MT<br>
> Driver/CMakeFiles/Driver.dir/Driver.cpp.obj -MF<br>
> "Driver/CMakeFiles/Driver.dir/Driver.cpp.obj.d" -o<br>
> Driver/CMakeFiles/Driver.dir/Driver.cpp.obj -c<br>
> C:/Dropbox/Source/braceless/src/Driver/Driver.cpp<br>
> C:/Dropbox/Source/braceless/src/Driver/Driver.cpp:11:42: fatal error:<br>
> Braceless0/Backend/Backend.hpp: No such file or directory<br>
> compilation terminated.<br>
> [117/325] Building CXX object Driver/CMakeFiles/Driver.dir/Setup.cpp.obj<br>
> ninja: build stopped: subcommand failed.<br>
><br>
> The problem is that the file Driver.cpp depends on Backend.hpp having been<br>
> created. But Driver.cpp should not be compiled until the second-last item<br>
> in the list of objects to make ([324/325]).<br>
><br>
> So, somehow, Ninja picks up the target Driver.obj and builds it way too<br>
> early. With GNU Make, everything goes according to plan, but with Ninja,<br>
> there's some sort of confusion somewhere.<br>
><br>
><br>
> Cheers,<br>
> Mikael<br>
><br>
> 2012/6/27 David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>><br>
>><br>
>> On Tue, Jun 26, 2012 at 6:30 PM, Mikael Lyngvig <<a href="mailto:mikael@lyngvig.org">mikael@lyngvig.org</a>><br>
>> wrote:<br>
>> > No, I delete the entire build tree (I build out of the source tree,<br>
>> > btw).<br>
>> ><br>
>> > The procedure is as follows:<br>
>> ><br>
>> > rem foo contains the source code<br>
>> > md foo-build<br>
>> > cd foo-build<br>
>> > cmake -G Ninja ..\foo<br>
>> > ninja<br>
>> > rem fails as described earlier<br>
>><br>
>><br>
>> But you didn't really describe the failure.<br>
>><br>
>> What is the error output? (from cmake or from ninja?)<br>
>><br>
>><br>
>> ><br>
>> > cd ..<br>
>> > rd /s /q foo-build<br>
>> > md foo-build<br>
>> > cd foo-build<br>
>> > cmake -G "MinGW Makefiles" ..\foo<br>
>> > make<br>
>> > rem succeeds as described earlier<br>
>> ><br>
>> > Thank you for your reply. If you need source, I can send you a zip<br>
>> > archive<br>
>> > as it is an incomplete open source project.<br>
>> ><br>
>> ><br>
>> > Cheers,<br>
>> > Mikael<br>
>> ><br>
>> ><br>
>> > 2012/6/27 David Cole <<a href="mailto:david.cole@kitware.com">david.cole@kitware.com</a>><br>
>> >><br>
>> >> You can't switch generators in the same build tree without deleting<br>
>> >> absolutely everything and starting over.<br>
>> >><br>
>> >> Is that what you're trying to do?<br>
>> >><br>
>> >> If you want a make build tree and a ninja build tree, you'll need two<br>
>> >> separate build trees....<br>
>> >><br>
>> >><br>
>> >> HTH,<br>
>> >> David<br>
>> >><br>
>> >><br>
>> >> On Tue, Jun 26, 2012 at 4:45 PM, Mikael Lyngvig <<a href="mailto:mikael@lyngvig.org">mikael@lyngvig.org</a>><br>
>> >> wrote:<br>
>> >> > Hi,<br>
>> >> ><br>
>> >> > I am a fan of Ninja. Since I started using it, everything's been<br>
>> >> > built<br>
>> >> > much, much faster than before. Among other things because I use<br>
>> >> > CMake<br>
>> >> > to<br>
>> >> > publish headers to the binary directory so as to allow me to include<br>
>> >> > the<br>
>> >> > headers with a relative path without having to move all my headers to<br>
>> >> > a<br>
>> >> > central include directory (I want my source files and headers to be<br>
>> >> > in<br>
>> >> > the<br>
>> >> > same directory). Ninja does this very fast, whereas GNU Make takes<br>
>> >> > forever<br>
>> >> > to publish my header files.<br>
>> >> ><br>
>> >> > However, I have a puzzling problem: Out of the blue, Ninja started<br>
>> >> > failing<br>
>> >> > to build my project. If I remake the project with 'cmake -G "MinGW<br>
>> >> > Makefiles"', it takes ages to build but it succeeds. If I do 'cmake<br>
>> >> > -G<br>
>> >> > Ninja', it quickly aborts because it seems that either CMake or Ninja<br>
>> >> > wants<br>
>> >> > to build one of the last targets at a very early point in the build<br>
>> >> > phase.<br>
>> >> > I have an executable, driver.exe, which is supposed to be built as<br>
>> >> > the<br>
>> >> > very<br>
>> >> > last item. With Ninja, however, it pops up around 20 percent into<br>
>> >> > the<br>
>> >> > build<br>
>> >> > and the build fails because the dependent libraries are nowhere to be<br>
>> >> > found<br>
>> >> > (they haven't been built yet). I have tried clearing the binaries<br>
>> >> > directory<br>
>> >> > (rd /s /q foo & md foo) and so on a number of times, but Ninja<br>
>> >> > insists<br>
>> >> > on<br>
>> >> > trying to build this final executable at a very early stage.<br>
>> >> ><br>
>> >> > Any ideas? I suppose the problem is caused by one of these three<br>
>> >> > things:<br>
>> >> ><br>
>> >> > 1. An error on my part. Very likely.<br>
>> >> > 2. An error in CMake's generation of Ninja scripts. Not unlikely<br>
>> >> > due<br>
>> >> > to<br>
>> >> > the still fairly immature support for Ninja.<br>
>> >> > 3. An error in Ninja. Highly unlikely as Ninja builds tons and<br>
>> >> > tons<br>
>> >> > of<br>
>> >> > projects all over the world each day and nobody seem to have run into<br>
>> >> > this<br>
>> >> > problem before.<br>
>> >> ><br>
>> >> > How do you locate the problem?<br>
>> >> ><br>
>> >> > Thanks in advance!<br>
>> >> ><br>
>> >> ><br>
>> >> > Cheers,<br>
>> >> > Mikael<br>
>> >> > -- Love Thy Frog!<br>
>> >> ><br>
>> >> > --<br>
>> >> ><br>
>> >> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>> >> ><br>
>> >> > Visit other Kitware open-source projects at<br>
>> >> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> >> ><br>
>> >> > Please keep messages on-topic and check the CMake FAQ at:<br>
>> >> > <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>> >> ><br>
>> >> > Follow this link to subscribe/unsubscribe:<br>
>> >> > <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
>> ><br>
>> ><br>
><br>
><br>
<br>
</div></div>What does your add_custom_command look like that generates Backend.hpp?<br>
<br>
(offline for a while, next response much later... :-)<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>-- Love Thy Frog!<br>
</div></div>