[cmake-developers] RFC: CMake precompiled header support and custom compiler based implementation

Matt McCormick matt.mccormick at kitware.com
Sun Mar 1 10:49:01 EST 2015


Hi Adam,

Thank you for working on this!  This would be a killer feature.


> I also want to suggest to put native precompiled header support somewhere high on the TODO list and I propose this simple API for specifying precompiled header for given target:
>
>         target_precompiled_header(<target> <path/to/precompiled_header.h>)
>
>         target_precompiled_header(<target> <path/to/precompiled_header.h> SHARED
>                                   <other_target_to_share_precompiled_header_with>)
>

I think the use of the "SHARED" specifier here should be avoided since
SHARED is used in add_library, and it has a completely different
meaning there.

An improvement in the API (although maybe not perfect):

  target_precomplied_header(<target>
                                          [PREFIX <path/to/prefix_header.h>]
                                          [FROM
<other_target_to_share_precomplied_header_with>])

 This way we do not need to specify all the targets to shared the
precompiled header with at one time and in one call.

Thanks,
Matt


More information about the cmake-developers mailing list