cmake: Cleanup ENABLE_PCH

Min is 3.17 checks for 3.16 are no longer needed.
This commit is contained in:
Juan Ramos 2023-11-22 14:50:04 -07:00 committed by GitHub
parent 4c121b68c8
commit 7c5fb5c1a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -102,10 +102,11 @@ option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
if(MINGW OR (APPLE AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")) if(MINGW OR (APPLE AND ${CMAKE_CXX_COMPILER_ID} MATCHES "GNU"))
# Workaround for CMake behavior on Mac OS with gcc, cmake generates -Xarch_* arguments # Workaround for CMake behavior on Mac OS with gcc, cmake generates -Xarch_* arguments
# which gcc rejects # which gcc rejects
option(ENABLE_PCH "Enables Precompiled header") set(ENABLE_PCH OFF)
else() message(NOTICE "Disabling PCH")
option(ENABLE_PCH "Enables Precompiled header" ON)
endif() endif()
option(ENABLE_PCH "Enables Precompiled header" ON)
option(ENABLE_CTEST "Enables testing" ON) option(ENABLE_CTEST "Enables testing" ON)
if(ENABLE_CTEST) if(ENABLE_CTEST)
@ -250,17 +251,11 @@ 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" AND ENABLE_PCH)
function(glslang_pch target pch) function(glslang_pch target pch)
target_precompile_headers(${target} PRIVATE ${pch})
endfunction()
else()
function(glslang_pch target pch)
endfunction()
if(ENABLE_PCH) 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") target_precompile_headers(${target} PRIVATE ${pch})
endif()
endif() endif()
endfunction()
if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External) if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/External)
# We depend on these for later projects, so they should come first. # We depend on these for later projects, so they should come first.