我很努力add_custom_command。让我详细解释这个问题。cmake add_custom_command
我有这些cxx文件和hxx文件的集合。我在每个脚本上运行perl脚本来生成某种类型的翻译文件。该命令看起来像
perl trans.pl source.cxx -o source_cxx_tro
以及类似的header.hxx文件。
因此,我将结束了一些多个命令(每个为一个文件)
然后我运行从这些命令所产生的输出的另一perl的scripn(source_cxx_tro,header_hxx_tro)
perl combine.pl source_cxx_tro header_hxx_tro -o dir.trx
DIR .trx是输出文件。
我有这样的事情。
Loop_Over_All_Files()
Add_Custom_Command (OUTPUT ${trofile} COMMAND perl trans.pl ${file} -o ${file_tro})
List (APPEND trofiles ${file_tro})
End_Loop()
Add_Custom_Command (TARGET LibraryTarget POST_BUILD COMMAND perl combine.pl ${trofiles} -o LibraryTarget.trx)
我期望的是在构建后构建目标时,将首先构建trofiles。但事实并非如此。 $ {trofiles}没有被构建,因此后期构建命令以失败告终。 有什么办法可以告诉POST_BUILD命令依赖于以前的自定义命令吗?
有什么建议吗?
由于提前, 苏里亚