Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cmake scripts for MSVC precompiled headers
- Loading branch information
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
if(MSVC) | |||
set(PCH_SUPPORTED TRUE) | |||
else() | |||
set(PCH_SUPPORTED FALSE) | |||
endif() | |||
|
|||
if(PCH_SUPPORTED) | |||
option(PLASMA_USE_PCH "Enable precompiled headers?" ON) | |||
endif(PCH_SUPPORTED) | |||
|
|||
macro(use_precompiled_header PrecompiledHeader PrecompiledSource) | |||
if(PLASMA_USE_PCH) | |||
if(MSVC) | |||
get_filename_component(PrecompiledBasename ${PrecompiledHeader} NAME_WE) | |||
set(PrecompiledBinary ${PrecompiledBasename}.pch) | |||
|
|||
add_definitions(/Fp"${PrecompiledBinary}") | |||
add_definitions(/Yu"${PrecompiledHeader}") | |||
add_definitions(/FI"${PrecompiledHeader}") | |||
set_source_files_properties(${PrecompiledSource} PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\"") | |||
endif(MSVC) | |||
endif(PLASMA_USE_PCH) | |||
endmacro(use_precompiled_header) |