Captain Jack sparrow
Captain Jack sparrow

Reputation: 1029

Force CMake to rebuild precompiled headers

How do I get CMake to rebuild all the precompiled headers? (Using g++ and Linux) And how do I get CMake to disable all precompiled headers?

I am getting some build errors that have sprung up and they refer to the .ch files. So want to investigate whether this is due to precompiled headers.

Upvotes: 3

Views: 1508

Answers (1)

Kevin
Kevin

Reputation: 18386

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:

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:

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.

Upvotes: 2

Related Questions