build: Fix PCH timestamp check with Clang frontend on Windows hosts (#4036)

- The '-fno-pch-timestamp' option should be used for Windows hosts, not Windows targets.
This commit is contained in:
双子叶植物
2026-07-03 00:37:46 +08:00
committed by GitHub
parent c8113ea462
commit c34a1c7f8e
+5 -5
View File
@@ -266,12 +266,12 @@ get_boost()
if(WIN32)
add_compile_definitions("_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS" "_CRT_SECURE_NO_WARNINGS" "NOMINMAX")
endif()
# Disable inclusion of timestamps in PCH files on Windows
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
string(APPEND CMAKE_C_FLAGS " -Xclang -fno-pch-timestamp")
string(APPEND CMAKE_CXX_FLAGS " -Xclang -fno-pch-timestamp")
endif()
# Disable inclusion of timestamps in precompiled headers on Windows
if(CMAKE_HOST_WIN32 AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
string(APPEND CMAKE_C_FLAGS " -Xclang -fno-pch-timestamp")
string(APPEND CMAKE_CXX_FLAGS " -Xclang -fno-pch-timestamp")
endif()
# Allow per-translation-unit parallel builds when using MSVC