Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larsch/cmake-precompiled-header
Visual Studio and GCC precompiled header macro for CMake
https://github.com/larsch/cmake-precompiled-header
Last synced: about 2 months ago
JSON representation
Visual Studio and GCC precompiled header macro for CMake
- Host: GitHub
- URL: https://github.com/larsch/cmake-precompiled-header
- Owner: larsch
- Created: 2014-09-17T02:19:21.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-11-01T19:32:38.000Z (over 4 years ago)
- Last Synced: 2024-04-21T02:20:18.844Z (2 months ago)
- Language: CMake
- Size: 26.4 KB
- Stars: 159
- Watchers: 16
- Forks: 43
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
Lists
- awesome-cmake - cmake-precompiled-header - Visual Studio and GCC precompiled header macro. [```[LICENSE]```](https://github.com/larsch/cmake-precompiled-header/blob/master/PrecompiledHeader.cmake#L31) (Utility Scripts)
README
# cmake-precompiled-header
Precompiled header setup for CMake. Supported CMake generators:
* Visual Studio
* NMake Makefiles
* Unix Makefiles (GCC)
* MinGW Makefiles
* MSYS Makefiles
* Ninja# Usage
Create a `pchheader.{c,cpp}` and `pchheader.h` and add then to the CMake target:
```cmake
add_library(target ... pchheader.cpp pchheeader.h)
````pchheader.h` can include all the huge header files that are used everywhere in your project:
```c
#include
#include
#include
#include
````pchheader.{c,cpp}` should just include the header file:
```c
#include "pchheader.h"
```In your main `CMakeLists.txt`, include the macro file:
```cmake
include(PrecompiledHeader.cmake)
```Then add this line, to set up precompiled headers:
```cmake
add_precompiled_header(target pchheader.h FORCEINCLUDE)
```Additional documentation is in [PrecompiledHeader.cmake](PrecompiledHeader.cmake).