<div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">Hi,</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I&#39;m having trouble understanding this behavior: what happens if the directory of the executable doesn&#39;t exist?</div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I created a minimum example CMakeLists.txt (where foo.cpp is just a hello world):</div><div style="font-family:arial,sans-serif;font-size:13px">

<br></div><span style="font-family:arial,sans-serif;font-size:13px">add_executable(test/test.bin foo.cpp)</span><br clear="all" style="font-family:arial,sans-serif;font-size:13px"><div style="font-family:arial,sans-serif;font-size:13px">

<br></div><div style="font-family:arial,sans-serif;font-size:13px">If the &quot;test&quot; directory doesn&#39;t exist, should the build system create it? Does that depend on the build system?</div><div style="font-family:arial,sans-serif;font-size:13px">

<br></div><div style="font-family:arial,sans-serif;font-size:13px">I tested with make, it gives an error when executing &quot;ld&quot;:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">

/usr/bin/ld: cannot open output file test/test.bin: No such file or directory<br></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">The command that generates the executable and gives the error is (from &quot;make VERBOSE=1&quot;):<br>

</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">/usr/bin/c++       CMakeFiles/test/test.bin.dir/foo.cpp.o  -o test/test.bin -rdynamic<br></div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">On the other hand, when I tested it with Ninja, it created the directory and finished without errors.</div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Shouldn&#39;t cmake&#39;s makefile proceed like that too?</div><div style="font-family:arial,sans-serif;font-size:13px">

<br></div><div style="font-family:arial,sans-serif;font-size:13px">Thanks!</div><div><br></div>-- <br>[]s<br><br>Relax, it&#39;s only ONES and ZEROS!!!!<br><br>Felipe Menezes Machado<br>Mestre em Ciência da Computação - DCC - UFMG
</div>