diff options
author | Brad King <brad.king@kitware.com> | 2022-08-15 14:48:18 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-08-15 14:48:27 (GMT) |
commit | d0a307ddcfbe78ed1c57bec0388549c1baf72386 (patch) | |
tree | 3673627f55bf14b916f6597b1346532f81f6e4b4 /Modules/Compiler | |
parent | 7f2eadafea81f6bf10c20ba67fb983628d054a0c (diff) | |
parent | 7b2a87c2ebede25e88a7d22a3c647be662c18391 (diff) | |
download | CMake-d0a307ddcfbe78ed1c57bec0388549c1baf72386.zip CMake-d0a307ddcfbe78ed1c57bec0388549c1baf72386.tar.gz CMake-d0a307ddcfbe78ed1c57bec0388549c1baf72386.tar.bz2 |
Merge topic 'mingw-flto'
7b2a87c2eb IPO: Do not use -flto=auto with GCC 10.x on Windows
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7559
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/GNU.cmake | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index db1eab5..48639cd 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -79,8 +79,15 @@ macro(__compiler_gnu lang) # * https://gcc.gnu.org/onlinedocs/gcc-9.5.0/gcc/Optimize-Options.html#Optimize-Options (no) # * https://gcc.gnu.org/onlinedocs/gcc-10.1.0/gcc/Optimize-Options.html#Optimize-Options (yes) # Since GCC 12.1, the abundance of a parameter produces a warning if compiling multiple targets. - if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 10.1) + # FIXME: What version of GCC for Windows added support for -flto=auto? 10.3 does not have it. + if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 11.0) list(APPEND __lto_flags -flto=auto) + elseif(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 10.1) + if (CMAKE_HOST_WIN32) + list(APPEND __lto_flags -flto=1) + else() + list(APPEND __lto_flags -flto=auto) + endif() else() list(APPEND __lto_flags -flto) endif() |