I'm currently trying to setup a CMake project with two executables, one of which is a simple utility used to generate code for the other. Relevant bits of CMakeLists.txt:
add_executable(lua2c lua2c.c)
add_custom_command(OUTPUT lcode.c COMMAND lua2c lcode.lua lcode.c MAIN_DEPENDENCY lua2c)
...
add_executable(darpem ... lcode.c)
With this setup, target lua2c winds up with no dependencies, which causes cc to complain about no input files. If I remove the add_custom_command line, then lua2c is built properly, but obviously doesn't generate the file lcode.c. Is this possible in CMake? Would I need to add a subdirectory dependency of sorts?
Using CMake version 2.8.1 on Ubuntu 13.04, x86-64.
NOTE: For my particular case, because lua2c is simple enough, I can use a different language. I am, however, still curious as to how this might be possible (for more complex setups).