Use precompiled headers for some glslang projects

This commit is contained in:
Jeff Bolz
2018-10-31 15:38:08 -05:00
parent a440fbb04f
commit 22d0b7cbad
10 changed files with 269 additions and 0 deletions

View File

@@ -44,6 +44,22 @@ if(USE_CCACHE)
endif(CCACHE_FOUND)
endif()
# Precompiled header macro. Parameters are source file list and filename for pch cpp file.
macro(PCH SRCS PCHCPP)
if(MSVC)
if (CMAKE_GENERATOR MATCHES "^Visual Studio")
set(PCH_NAME "$(IntDir)\\pch.pch")
else()
set(PCH_NAME "pch.pch")
endif()
# make source files use/depend on PCH_NAME
set_source_files_properties(${${SRCS}} PROPERTIES COMPILE_FLAGS "/Yupch.h /FIpch.h /Fp${PCH_NAME} /Zm300" OBJECT_DEPENDS "${PCH_NAME}")
# make PCHCPP file compile and generate PCH_NAME
set_source_files_properties(${PCHCPP} PROPERTIES COMPILE_FLAGS "/Ycpch.h /Fp${PCH_NAME} /Zm300" OBJECT_OUTPUTS "${PCH_NAME}")
list(APPEND ${SRCS} "${PCHCPP}")
endif()
endmacro(PCH)
project(glslang)
# make testing optional
include(CTest)