Obey ENABLE_PCH CMake option

This commit is contained in:
Julius Ikkala 2020-08-21 18:44:06 +03:00
parent f257e0ea6b
commit b357badc02

View File

@ -297,14 +297,16 @@ endfunction()
# glslang_pch() adds precompiled header rules to <target> for the pre-compiled # glslang_pch() adds precompiled header rules to <target> for the pre-compiled
# header file <pch>. As target_precompile_headers() was added in CMake 3.16, # header file <pch>. As target_precompile_headers() was added in CMake 3.16,
# this is a no-op if called on earlier versions of CMake. # this is a no-op if called on earlier versions of CMake.
if(NOT CMAKE_VERSION VERSION_LESS "3.16") if(NOT CMAKE_VERSION VERSION_LESS "3.16" AND ENABLE_PCH)
function(glslang_pch target pch) function(glslang_pch target pch)
target_precompile_headers(${target} PRIVATE ${pch}) target_precompile_headers(${target} PRIVATE ${pch})
endfunction() endfunction()
else() else()
function(glslang_pch target pch) function(glslang_pch target pch)
endfunction() endfunction()
message("Your CMake version is ${CMAKE_VERSION}. Update to at least 3.16 to enable precompiled headers to speed up incremental builds") if(ENABLE_PCH)
message("Your CMake version is ${CMAKE_VERSION}. Update to at least 3.16 to enable precompiled headers to speed up incremental builds")
endif()
endif() endif()
if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External) if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External)