我很努力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命令依賴於以前的自定義命令嗎?
有什麼建議嗎?
由於提前, 蘇里亞