gpt4 book ai didi

CMake - 始终构建特定文件

转载 作者:太空宇宙 更新时间:2023-11-04 03:14:17 24 4
gpt4 key购买 nike

我有一个特定的文件,无论它是否被修改,都应该在每次编译时重建。原因是它依赖于值发生变化的系统宏。我怎么能用CMake强制重建?我不想将它绑定(bind)到特定目标:在 CMakeLists.txt 中指定的任何目标开始实际构建过程之前,应该“接触”该文件。

最佳答案

CMake 有一个 add_custom_target命令:

Adds a target with the given name that executes the given commands. The target has no output file and is always considered out of date even if the commands try to create a file with the name of the target. [...] By default nothing depends on the custom target. Use the add_dependencies() command to add dependencies to or from other targets.

关于CMake - 始终构建特定文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53432251/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com