summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-04-25 14:41:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-04-25 14:41:59 (GMT)
commit1a676eb580866fa3fbaa83823e410018dc8b7c8c (patch)
tree9dc3f9735dc69440628faca5ffbb166a245968cb
parente8f9b6ee430a659b8ff772a68fa8b102f7b5d70f (diff)
parentf65a6d2cb18c0614e3adb27e007687cde570e8ec (diff)
downloadCMake-1a676eb580866fa3fbaa83823e410018dc8b7c8c.zip
CMake-1a676eb580866fa3fbaa83823e410018dc8b7c8c.tar.gz
CMake-1a676eb580866fa3fbaa83823e410018dc8b7c8c.tar.bz2
Merge topic 'lto-gnu-apple'
f65a6d2cb1 GNU: Do not use "fat-lto-objects" flags for IPO on Apple platforms Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9461
-rw-r--r--Modules/Compiler/GNU.cmake2
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt8
2 files changed, 7 insertions, 3 deletions
diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake
index 1113e9a..857399c 100644
--- a/Modules/Compiler/GNU.cmake
+++ b/Modules/Compiler/GNU.cmake
@@ -151,7 +151,7 @@ macro(__compiler_gnu lang)
list(APPEND __lto_flags -flto)
endif()
- if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7)
+ if(NOT CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 4.7 AND NOT APPLE)
# '-ffat-lto-objects' introduced since GCC 4.7:
# * https://gcc.gnu.org/onlinedocs/gcc-4.6.4/gcc/Option-Summary.html (no)
# * https://gcc.gnu.org/onlinedocs/gcc-4.7.4/gcc/Option-Summary.html (yes)
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index a0f1862..2e8e14f 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -113,11 +113,15 @@ target_link_libraries(FortranCInterface PUBLIC symbols)
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" AND
CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
target_compile_options(FortranCInterface PRIVATE "-fno-lto")
- target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
+ if(NOT APPLE)
+ target_compile_options(myfort PRIVATE "-flto=auto" "-ffat-lto-objects")
+ endif()
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12)
- target_compile_options(symbols PRIVATE "-flto=auto" "-ffat-lto-objects")
+ if(NOT APPLE)
+ target_compile_options(symbols PRIVATE "-flto=auto" "-ffat-lto-objects")
+ endif()
endif()
file(GENERATE OUTPUT exe-$<CONFIG>.cmake CONTENT [[