c - add_custom_command from another target -


i'm trying setup cmake project 2 executables, 1 of simple utility used generate code 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 setup, target lua2c winds no dependencies, causes cc complain no input files. if remove add_custom_command line, lua2c built properly, doesn't generate file lcode.c. possible in cmake? need add subdirectory dependency of sorts?

using cmake version 2.8.1 on ubuntu 13.04, x86-64.

note: particular case, because lua2c simple enough, can use different language. am, however, still curious how might possible (for more complex setups).

from documentation :

note main_dependency optional , used suggestion visual studio hang custom command.

maybe should solve problem :

add_executable(lua2c lua2c.c) add_custom_command(output lcode.c command lua2c lcode.lua lcode.c depends lua2c) #                                                                 ^^^^^^^ ... add_executable(darpem ... lcode.c) 

or if doesn't work, 1 should work :

add_executable(lua2c lua2c.c) add_custom_command(target lua2c                     post_build                     command lua2c lcode.lua lcode.c )  ... add_executable(darpem ... lcode.c) add_dependencies( darpem lua2c ) 

it add post build event after build of lua2c. , add lua2c dependency of darpem.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -