<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'm having trouble understanding this behavior: what happens if the directory of the executable doesn'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 "test" directory doesn'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 "ld":</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 "make VERBOSE=1"):<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't cmake'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's only ONES and ZEROS!!!!<br><br>Felipe Menezes Machado<br>Mestre em Ciência da Computação - DCC - UFMG
</div>