相关疑难解决方法(0)

cmake add_custom_command

我正在努力使用add_custom_command.让我详细解释一下这个问题.

我有这些cxx文件和hxx文件.我在每个脚本上运行一个perl脚本来生成某种翻译文件.该命令看起来像

perl trans.pl source.cxx -o source_cxx_tro
Run Code Online (Sandbox Code Playgroud)

同样对于header.hxx文件也是如此.

所以我最终会得到一些多个命令(每个命令用于一个文件)

然后我在这些命令生成的输出上运行另一个perl脚本(source_cxx_tro,header_hxx_tro)

perl combine.pl source_cxx_tro header_hxx_tro -o dir.trx
Run Code Online (Sandbox Code Playgroud)

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)
Run Code Online (Sandbox Code Playgroud)

我期望在构建post构建目标时,首先构建trofiles.但事实并非如此.$ {trofiles}没有构建,因此post build命令以失败告终.有什么办法可以告诉POST_BUILD命令取决于以前的自定义命令吗?

有什么建议 ?

谢谢,苏里亚

cmake

16
推荐指数
1
解决办法
5万
查看次数

标签 统计

cmake ×1