MACRO(ADD_MSVC_PRECOMPILED_HEADER_IN_FOLDER SourcesVar Folder)
	IF(MSVC)
		SET(PrecompiledBasename "stdafx")
		SET(PrecompiledHeader "${PrecompiledBasename}.h")
		SET(PrecompiledSource "${Folder}/${PrecompiledBasename}.cpp")
		SET(PrecompiledBinary "$(IntDir)${PROJECT_NAME}.pch")
		FOREACH(_source ${SourcesVar})
			SET_SOURCE_FILES_PROPERTIES(${_source} PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" OBJECT_DEPENDS "${PrecompiledBinary}")
		ENDFOREACH()
		SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource} PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" OBJECT_OUTPUTS "${PrecompiledBinary}")
	ENDIF(MSVC)
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER_IN_FOLDER)

MACRO(ADD_MSVC_PRECOMPILED_HEADER SourcesVar)
	IF(MSVC)
		SET(PrecompiledBasename "stdafx")
		SET(PrecompiledHeader "${PrecompiledBasename}.h")
		SET(PrecompiledSource "${CMAKE_CURRENT_LIST_DIR}/${PrecompiledBasename}.cpp")
		SET(PrecompiledBinary "$(IntDir)${PROJECT_NAME}.pch")
		FOREACH(_source ${SourcesVar})
			SET_SOURCE_FILES_PROPERTIES(${_source} PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" OBJECT_DEPENDS "${PrecompiledBinary}")
		ENDFOREACH()
		SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource} PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" OBJECT_OUTPUTS "${PrecompiledBinary}")
	ENDIF(MSVC)
ENDMACRO(ADD_MSVC_PRECOMPILED_HEADER)
