我想用输出文件做add_custom_command之类的事情
name作为生成的makefile中的目标.有一种优雅的方式
这样做?
我见过的所有示例(例如the CMake FAQ re: latex)都使用add_custom_command来告诉如何生成所需的输出文件,然后使用add_custom_target来创建目标.例如.:
add_executable (hello hello.c)
add_custom_command(OUTPUT hello.bin
COMMAND objcopy --output-format=binary hello hello.bin
DEPENDS hello
COMMENT "objcopying hello to hello.bin")
add_custom_target(bin ALL DEPENDS hello.bin)
但是,生成的makefile中的目标名称则为bin
比hello.bin.有没有办法让hello.bin本身成为目标
在生成的makefile中?
我试过的一些解决方案不起作用:
>更改为:add_custom_target(hello.bin ALL DEPENDS hello.bin)会在makefile中产生循环依赖关系.