diff options
| author | OatmealDome <OatmealDome@users.noreply.github.com> | 2026-01-25 22:00:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-25 22:00:14 -0500 |
| commit | 74ff1f76c5be031f8a65eae8057c82d60e8b09ee (patch) | |
| tree | 33d36d91f23710f27a9442a29acef7e6e5a10c58 /CMakeLists.txt | |
| parent | 6e183e462a6692d7213dc82fd0a8543eb9e7750d (diff) | |
| parent | eec35a214dd2f8b0d18a66340e7b34e2928e1411 (diff) | |
Merge pull request #14299 from SuperSamus/cmake-ipo-modern
CMakeLists: Use `CMAKE_INTERPROCEDURAL_OPTIMIZATION` for LTO
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c9e1a8e3fa..a75bf1692f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -377,15 +377,13 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin") endif() if(ENABLE_LTO) - if(CMAKE_C_COMPILER_ID MATCHES "MSVC") - add_compile_options(/GL) - string(APPEND CMAKE_EXE_LINKER_FLAGS " /LTCG") + include(CheckIPOSupported) + check_ipo_supported(RESULT supported OUTPUT error) + + if(supported) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) else() - check_and_add_flag(LTO -flto) - if(CMAKE_CXX_COMPILER_ID STREQUAL GNU) - set(CMAKE_AR gcc-ar) - set(CMAKE_RANLIB gcc-ranlib) - endif() + message(STATUS "IPO / LTO not supported: <${error}>") endif() endif() |
