forked from leapmotion/cmake-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddPCH.cmake
21 lines (20 loc) · 801 Bytes
/
AddPCH.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#MSVC pch helper. Copied from http://pastebin.com/84dm5rXZ and modified by Walter Gray.
#Files already in SourcesVar will be marked as using a PCH, then the pch files will be
#appended to the list.
function(add_pch SourcesVar PrecompiledHeader PrecompiledSource)
if(MSVC)
set_source_files_properties(${PrecompiledSource}
PROPERTIES
COMPILE_FLAGS "/Yc${PrecompiledHeader}"
)
foreach( src_file ${${SourcesVar}} )
set_source_files_properties(
${src_file}
PROPERTIES
COMPILE_FLAGS "/Yu${PrecompiledHeader}"
)
endforeach( src_file ${${SourcesVar}} )
list(APPEND ${SourcesVar} ${PrecompiledHeader} ${PrecompiledSource})
set(${SourcesVar} ${${SourcesVar}} PARENT_SCOPE)
endif(MSVC)
endfunction(add_pch)