Use CMake's builtin functionality for PCHs

`glslang_pch()` did manual mangling of the compiler flags to enable pre-compiled headers.
I couldn't get this approach to work with the `MachineIndependent` subdirectory, but fortunately CMake has added first-class support for precompiled headers in 3.16, which does work with subdirectories.

Moved `glslang_pch()` to the other global function declarations.

`glslang_pch()` is a no-op when using CMake earlier than `3.16`.

CMake's PCH implementation does not need the `pch.cpp` files, so just remove them.
This commit is contained in:
Ben Clayton
2020-07-07 13:24:04 +01:00
parent 3604be156c
commit 31cad22758
7 changed files with 15 additions and 121 deletions

View File

@@ -60,9 +60,9 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/Remap.FromFile.cpp)
endif()
glslang_pch(TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/pch.cpp)
add_executable(glslangtests ${TEST_SOURCES})
glslang_pch(glslangtests ${CMAKE_CURRENT_SOURCE_DIR}/pch.h)
set_property(TARGET glslangtests PROPERTY FOLDER tests)
glslang_set_link_args(glslangtests)
if(ENABLE_GLSLANG_INSTALL)