Using pre-compiled headers with CMake

后端 未结 14 2175
刺人心
刺人心 2020-12-12 10:39

I have seen a few (old) posts on the \'net about hacking together some support for pre-compiled headers in CMake. They all seem a bit all-over the place and everyone has the

14条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-12 11:08

    CMake has just gained support for PCHs, it should be available in the upcoming 3.16 release, due 2019-10-01:

    https://gitlab.kitware.com/cmake/cmake/merge_requests/3553

      target_precompile_headers(
         [header1...]
        [ [header2...] ...])
    

    There is ongoing discussion on supporting sharing PCHs between targets: https://gitlab.kitware.com/cmake/cmake/issues/19659

    There is some additional context (motivation, numbers) available at https://blog.qt.io/blog/2019/08/01/precompiled-headers-and-unity-jumbo-builds-in-upcoming-cmake/

提交回复
热议问题