9
A
回答
14
從CMake的文檔:
add_custom_command(TARGET target
PRE_BUILD | PRE_LINK | POST_BUILD`
COMMAND command1 [ARGS] [args1...]
[COMMAND command2 [ARGS] [args2...] ...]
[WORKING_DIRECTORY dir]
[COMMENT comment] [VERBATIM])
This defines a new command that will be associated with building the specified
target. When the command will happen is determined by which of the following
is specified:
PRE_BUILD - run before all other dependencies
PRE_LINK - run after other dependencies
POST_BUILD - run after the target has been built
Note that the PRE_BUILD option is only supported on Visual Studio 7 or later.
For all other generators PRE_BUILD will be treated as PRE_LINK.
例如,如果你的目標是一個名爲MyProject
和你想要的建築後的參數-1 -2
運行命令SomeCommand
,添加以下行後您add_executable
或add_library
呼叫,因爲目標已經被定義爲:
add_custom_command(TARGET MyProject
POST_BUILD
COMMAND SomeCommand ARGS "-1 -2"
COMMENT "Running SomeCommand")
莫見https://cmake.org/cmake/help/v2.8.8/cmake.html#command:add_custom_command詳細瞭解如何使用add_custom_command()
。
相關問題
- 1. 從MSVC項目生成CMAKE?
- 2. C++ - 自定義生成事件
- 3. 不能添加自定義項目arrayadapter
- 4. 添加自定義項目到TShellTreeView
- 5. 如何自定義在故事板上添加的tabbar項目
- 6. 添加自定義iOS生成設置選項
- 7. 如何爲所有子模塊添加CMake自定義目標
- 8. 如何將自定義生成參數添加到Visual Studio 2013 C#項目?
- 9. 自動將生成的源文件添加到xcode項目
- 10. VS2010「添加項目」目錄更改
- 11. 自定義AlertDialog.Builder添加自定義按鈕事件點擊
- 12. 添加項目自定義ListView與自定義自定義適配器
- 13. Qt Creator中的自動完成:如何爲cmake項目添加頭文件
- 14. 使用CMake生成C#項目
- 15. 如何將鼠標事件添加到自定義模板列表框項目?
- 16. 圖像未添加到項目添加到自定義列表
- 17. 如何將一堆aspx文件添加到網站定義sp2010 vs2010項目
- 18. 使用CMake生成VS2010解決方案無效包括目錄
- 19. 在VS2010中爲ClickOnce添加自定義先決條件
- 20. 將google APIs庫添加到cmake生成
- 21. CMake GUI - 添加XCode生成器
- 22. VS2010:創建後生成事件(C#)
- 23. FrameworkVersion在預生成事件VS2010 WPF
- 24. 使用我自己的源代碼目錄生成vs2010項目文件
- 25. 如何添加自定義文件夾來安裝項目?
- 26. Angular將自定義.css文件添加到Angular-CLI項目
- 27. 將生成的子項目配置文件添加到CMake中的主項目中
- 28. 在VS2010中添加gdi +參考項目
- 29. 在運行時自動生成自定義事件
- 30. 如何將自定義HTML添加到jQuery自動完成項目?
非常感謝... –
結構良好,非常有用的答案。 :d – MABVT