<div dir="ltr">On Tue, Sep 3, 2013 at 2:33 PM, Matthew Woehlke <span dir="ltr"><<a href="mailto:matthew.woehlke@kitware.com" target="_blank">matthew.woehlke@kitware.com</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 2013-09-03 13:21, Felipe Menezes Machado wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm having trouble understanding this behavior: what happens if the<br>
directory of the executable doesn't exist?<br>
<br>
I created a minimum example CMakeLists.txt (where foo.cpp is just a hello<br>
world):<br>
<br>
add_executable(test/test.bin foo.cpp)<br>
<br>
If the "test" directory doesn't exist, should the build system create it?<br>
</blockquote>
<br></div>
Well, ninja seems to think so :-).<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does that depend on the build system?<br>
</blockquote>
<br></div>
Yes; ninja has a feature where it creates any non-existing directories that are used by any outputs. At least make does not have a similar feature. I don't know about other generators (e.g. xcode, msvc).<div class="im">
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I tested with make, it gives an error when executing "ld":<br>
<br>
/usr/bin/ld: cannot open output file test/test.bin: No such file or<br>
directory<br>
<br>
The command that generates the executable and gives the error is (from<br>
"make VERBOSE=1"):<br>
<br>
/usr/bin/c++ CMakeFiles/test/test.bin.dir/<u></u>foo.cpp.o -o test/test.bin<br>
-rdynamic<br>
<br>
On the other hand, when I tested it with Ninja, it created the directory<br>
and finished without errors.<br>
</blockquote>
<br></div>
Interesting question. I suppose CMake could be taught to generate make rules to emulate ninja's behavior.<br>
<br>
Whether or not such a thing should be done is an interesting question. (Especially as it probably should be done for all generators, it at all.)<br> <br></blockquote></div><div class="gmail_extra"><br></div>It would at least be a very interesting optional feature. Like something you specify in your CMakeLists.txt file, that every output directory should be created.<br clear="all">
<div><br></div>-- <br>[]s<br><br>Relax, it's only ONES and ZEROS!!!!<br><br>Felipe Menezes Machado<br>Mestre em Ciência da Computação - DCC - UFMG
</div></div>