Created
November 21, 2016 01:58
-
-
Save kbinani/3e55feb6e4615d3624af90c5eaf57c33 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
macro(add_msvc_precompiled_header PrecompiledHeader PrecompiledSource SourcesVar) | |
if(MSVC) | |
get_filename_component(PrecompiledBasename ${PrecompiledHeader} NAME_WE) | |
set(PrecompiledBinary "$(IntDir)/${PrecompiledBasename}.pch") | |
set(Sources ${${SourcesVar}}) | |
set_source_files_properties(${PrecompiledSource} | |
PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" | |
OBJECT_OUTPUTS "${PrecompiledBinary}") | |
set_source_files_properties(${Sources} | |
PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\"" | |
OBJECT_DEPENDS "${PrecompiledBinary}") | |
list(APPEND ${SourcesVar} ${PrecompiledSource}) | |
list(APPEND ${SourcesVar} ${PrecompiledHeader}) | |
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FI\"${PrecompiledHeader}\"") | |
endif() | |
endmacro(add_msvc_precompiled_header) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment