Using pre-compiled headers with CMake

后端 未结 14 2178
刺人心
刺人心 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:05

    Don't even go there. Precompiled headers mean that whenever one of the headers changes, you have to rebuild everything. You're lucky if you have a build system that realizes this. More often than never, your build will just fail until you realize that you changed something that is being precompiled, and therefore you need to do a full rebuild. You can avoid this mostly by precompiling the headers that you are absolutely positive won't change, but then you're giving up a large part of the speed gain as well.

    The other problem is that your namespace gets polluted with all kinds of symbols that you don't know or care about in many places where you'd be using the precompiled headers.

提交回复
热议问题