summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/Windows-Clang.cmake
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2021-11-14 13:05:25 (GMT)
committerRaul Tambre <raul@tambre.ee>2021-11-14 13:05:25 (GMT)
commit3155b23260472404a5abda344537e4994eabb054 (patch)
treeddc397de4aa40e79760a316524ef0065b9bf55e3 /Modules/Platform/Windows-Clang.cmake
parentb31e60e76d05d89090769860ef9b38cfd1e50667 (diff)
downloadCMake-3155b23260472404a5abda344537e4994eabb054.zip
CMake-3155b23260472404a5abda344537e4994eabb054.tar.gz
CMake-3155b23260472404a5abda344537e4994eabb054.tar.bz2
Clang/Windows: Use ThinLTO if possible to match other platforms
Fixes #22905.
Diffstat (limited to 'Modules/Platform/Windows-Clang.cmake')
-rw-r--r--Modules/Platform/Windows-Clang.cmake7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake
index 1c32018..c4d6fd8 100644
--- a/Modules/Platform/Windows-Clang.cmake
+++ b/Modules/Platform/Windows-Clang.cmake
@@ -56,7 +56,12 @@ macro(__windows_compiler_clang_gnu lang)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_LIBRARIES 1)
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_INCLUDES 1)
- set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
+ if(CMAKE_${lang}_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9)
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin")
+ else()
+ set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto")
+ endif()
+
set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES)
set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES)
set(CMAKE_${lang}_ARCHIVE_CREATE_IPO "<CMAKE_AR> qc <TARGET> <LINK_FLAGS> <OBJECTS>")