From 6e3655db2cc8202424e54bdde83e4240eb680cc3 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Mon, 8 Jul 2019 18:52:23 +0200 Subject: Clang: add LTO support for GNU-command line clang on windows --- Modules/Platform/Windows-Clang.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/Windows-Clang.cmake b/Modules/Platform/Windows-Clang.cmake index 728e0b9..6a12381 100644 --- a/Modules/Platform/Windows-Clang.cmake +++ b/Modules/Platform/Windows-Clang.cmake @@ -44,15 +44,22 @@ 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") + set(_CMAKE_${lang}_IPO_SUPPORTED_BY_CMAKE YES) + set(_CMAKE_${lang}_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) + set(CMAKE_${lang}_ARCHIVE_CREATE_IPO " cr ") + set(CMAKE_${lang}_ARCHIVE_APPEND_IPO " r ") + set(CMAKE_${lang}_ARCHIVE_FINISH_IPO " ") + # Create archiving rules to support large object file lists for static libraries. set(CMAKE_${lang}_ARCHIVE_CREATE " qc ") set(CMAKE_${lang}_ARCHIVE_APPEND " q ") set(CMAKE_${lang}_ARCHIVE_FINISH " ") set(CMAKE_${lang}_CREATE_SHARED_LIBRARY - " -nostartfiles -nostdlib -o ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /implib: -Xlinker /pdb: -Xlinker /version:. ") + " -fuse-ld=lld-link -nostartfiles -nostdlib -o ${CMAKE_GNULD_IMAGE_VERSION} -Xlinker /implib: -Xlinker /pdb: -Xlinker /version:. ") set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) set(CMAKE_${lang}_LINK_EXECUTABLE - " -nostartfiles -nostdlib -o -Xlinker /implib: -Xlinker /pdb: -Xlinker /version:. ${CMAKE_GNULD_IMAGE_VERSION} ") + " -fuse-ld=lld-link -nostartfiles -nostdlib -o -Xlinker /implib: -Xlinker /pdb: -Xlinker /version:. ${CMAKE_GNULD_IMAGE_VERSION} ") set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -Xclang -flto-visibility-public-std -D_MT -Xclang --dependent-lib=libcmt) set(CMAKE_${lang}_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -D_DLL -D_MT -Xclang --dependent-lib=msvcrt) -- cgit v0.12