简体   繁体   English

强制 CMake 重建预编译头文件

[英]Force CMake to rebuild precompiled headers

How do I get CMake to rebuild all the precompiled headers?如何让 CMake 重建所有预编译头文件? (Using g++ and Linux) And how do I get CMake to disable all precompiled headers? (使用 g++ 和 Linux)我如何让 CMake 禁用所有预编译头文件?

I am getting some build errors that have sprung up and they refer to the .ch files.我收到了一些已经出现的构建错误,它们引用了.ch文件。 So want to investigate whether this is due to precompiled headers.所以想调查一下这是否是由于预编译的头文件造成的。

In CMake, and assuming use of the target_precompile_headers() command, you can disable precompiled headers for a specific CMake target by setting the DISABLE_PRECOMPILE_HEADERS property:在 CMake 中,假设使用了target_precompile_headers()命令,您可以通过设置DISABLE_PRECOMPILE_HEADERS属性来禁用特定 CMake 目标的预编译头:

set_target_properties(MyTarget PROPERTIES 
    DISABLE_PRECOMPILE_HEADERS ON
)

or you can disable precompiled headers for the entire project by setting this in the top-level CMake file:或者您可以通过在顶级 CMake 文件中进行设置来禁用整个项目的预编译头文件:

set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON)

To get CMake to rebuild all of the precompiled headers, you could simply delete those that have been generated, so they are re-generated.要让 CMake 重建所有预编译的头文件,您可以简单地删除那些已生成的头文件,以便重新生成它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM