简体   繁体   中英

Using precompiled headers in my project (clang/llvm, but gcc as well). How to deploy the -include option at make?

I have a quite large project that would enjoy some speedup in compilation. I'm on OSX 10.8 (clang/llvm), but I will port this to gcc as well. I am trying to tinker with .pch files but I noted in the llvm documentation that pch files are only parsed and used if -include is used at the command line. It doesn't automatically do it from the #include directive in the file.

I was wondering how to add automatically -include for the proper include files. I am using CMake to create the makefiles.

Likely it's enough to add required flags to CMAKE_CXX_FLAGS. Something like

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include <you-precompiled-header>")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM