2013-04-20 21:15:59 +00:00
|
|
|
MACRO(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
|
|
|
|
IF(MSVC)
|
|
|
|
GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
|
2013-07-08 10:29:49 +00:00
|
|
|
SET(PrecompiledBinary "${CMAKE_CFG_INTDIR}/${PrecompiledBasename}.pch")
|
2013-04-20 21:15:59 +00:00
|
|
|
SET(Sources ${${SourcesVar}})
|
|
|
|
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
|
2015-05-19 03:44:54 +00:00
|
|
|
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\""
|
|
|
|
OBJECT_OUTPUTS "${PrecompiledBinary}")
|
|
|
|
|
|
|
|
# Do not consider .c files
|
|
|
|
foreach(fname ${Sources})
|
|
|
|
GET_FILENAME_COMPONENT(fext ${fname} EXT)
|
|
|
|
if(fext STREQUAL ".cpp")
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(${fname}
|
|
|
|
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledBinary}\" /FI\"${PrecompiledBinary}\" /Fp\"${PrecompiledBinary}\""
|
|
|
|
OBJECT_DEPENDS "${PrecompiledBinary}")
|
|
|
|
endif(fext STREQUAL ".cpp")
|
|
|
|
endforeach(fname)
|
|
|
|
|
2013-04-20 21:15:59 +00:00
|
|
|
ENDIF(MSVC)
|
|
|
|
# Add precompiled header to SourcesVar
|
|
|
|
LIST(APPEND ${SourcesVar} ${PrecompiledSource})
|
2015-05-19 03:44:54 +00:00
|
|
|
|
|
|
|
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
|