# CMake Error: check_ipo_supported() failed - LTO not supported by compiler / toolchain

- **ID:** `cmake/check-ipos-supported-false`
- **Domain:** cmake
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The compiler or linker does not support Link-Time Optimization (LTO) for the current build configuration, or the check_ipo_supported() call detected incompatibility.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| cmake 3.21.0 | active | — | — |
| cmake 3.22.0 | active | — | — |
| cmake 3.23.0 | active | — | — |

## Workarounds

1. **Disable LTO for the affected target by setting the property explicitly:

set_target_properties(mytarget PROPERTIES INTERPROCEDURAL_OPTIMIZATION FALSE)

Or set globally:

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)** (95% success)
   ```
   Disable LTO for the affected target by setting the property explicitly:

set_target_properties(mytarget PROPERTIES INTERPROCEDURAL_OPTIMIZATION FALSE)

Or set globally:

set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)
   ```
2. **Use a compiler that supports LTO (e.g., GCC 4.9+ or Clang 3.9+). For GCC, ensure the 'gold' linker is available:

sudo apt-get install binutils-gold

Then reconfigure with:

cmake -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE -DCMAKE_LINKER=/usr/bin/ld.gold /path/to/source** (80% success)
   ```
   Use a compiler that supports LTO (e.g., GCC 4.9+ or Clang 3.9+). For GCC, ensure the 'gold' linker is available:

sudo apt-get install binutils-gold

Then reconfigure with:

cmake -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE -DCMAKE_LINKER=/usr/bin/ld.gold /path/to/source
   ```

## Dead Ends

- **Set CMAKE_INTERPROCEDURAL_OPTIMIZATION to TRUE manually** — Overrides the check but may cause linker errors if the toolchain genuinely lacks LTO support; build will fail later. (70% fail)
- **Upgrade CMake to the latest version** — LTO support depends on the compiler, not CMake version; upgrading CMake does not add LTO to an unsupported compiler. (90% fail)
