项目构建工具 - CMake (3)自定义cmake命令
发布日期:2021-06-29 14:21:07 浏览次数:3 分类:技术文章

本文共 483 字,大约阅读时间需要 1 分钟。

cmake中执行shell命令,有两种形式:execute_process,和add_custom_command。

其中add_custom_command可以实现复杂的逻辑命令。

自定义cmake的命令,有两种形式:add_custom_command(OUTPUT .....) 和 add_custom_command(TARGET ......)

错误1:

使用 cmake -P 调试 带有add_custom_command(...) 的脚本,会提示:add_executable command is not scriptable

cmake -P CMakeLists.txt

CMake Error at CMakeLists.txt:6 (add_executable):
  add_executable command is not scriptable

对策:cmake ./ 直接运行。将脚本include进CMakeLists.txt

错误2

对策:在脚本中,增加 cmake_minimum_required(VERSION 3.10)

 

转载地址:https://chilaidashi.blog.csdn.net/article/details/107122288 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:项目构建工具 - CMake (4)自定义宏
下一篇:奇葩的名词 GLOB

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月02日 21时07分27秒