3

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.

Kevin
  • 16,549
  • 8
  • 60
  • 74
Captain Jack sparrow
  • 959
  • 1
  • 13
  • 28

1 Answers1

2

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.

Kevin
  • 16,549
  • 8
  • 60
  • 74