<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 20, 2015 at 3:27 PM, Tom Kacvinsky <span dir="ltr"><<a href="mailto:tom.kacvinsky@vectorcast.com" target="_blank">tom.kacvinsky@vectorcast.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class=""><div class="h5"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 20, 2015 at 2:57 PM, Tom Kacvinsky <span dir="ltr"><<a href="mailto:tom.kacvinsky@vectorcast.com" target="_blank">tom.kacvinsky@vectorcast.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I have need to make an executable that depends on a generated file.  I've read several tutorials on how to do this, but even after following those instructions, I get this error:<br><br>CMake Error at CMakeLists.txt:436 (add_executable):<br>  Cannot find source file:<br><br>    .chop/maint.adb<br><br>  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp<br><br></div><div>has anyone done this, and if so, do you have tips on how to proceed?<br><br></div><div>Thanks,<br><br></div><div>Tom<br></div></div>
</blockquote></div><br><div dir="ltr">My mistake, the tutorials I looked at were for using 
generated files in add_library.  I do have a working add_library with 
generated files, but I can't seem to get generated files to work with 
add_executable.  So is there a difference between the two?  add_library 
allows for use of generated files, but add_executable does not?<br></div><br></div></div></div></blockquote><div><br></div><div>OK, figured something out.  If the rule to generate the file is at the same level CMakeLists.txt (or higher) than the CMakeLists.txt that contains the add_executable command which uses the gnerated file, then everything is OK.  But if the add_executable is at a higher level than the "rule" that gnerates the file, everything falls apart.  This is why my add_library example worked but by add_executable example was not.  To confuse the issue even further, I have this setup<br><br></div><div>foo/CMakeLists.txt -> contains macro that uses add_executable<br></div><div>foo/vcast/CMakeLists.txt -> contains rule to generate file<br></div><div>foo/vcast/progs/CMakeLists.txt -> invokes macro defined at level 1, using the file generated at level 2<br><br></div><div>Apparently this is enough to thow things off.  I though the add_executable would have "occurred" at level 3 as that is where the macro is expanded, but I am guessing cmake expansion of macros doesn't work that way.<br></div></div><br></div></div>