# CMake Error: INTERFACE_LIBRARY targets may only have INTERFACE properties. The SOURCES property of target "mylib" is not allowed.

- **ID:** `cmake/interface-library-sources-ignored`
- **Domain:** cmake
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 92%

## Root Cause

Attempting to set source files on an INTERFACE library target, which by definition cannot have compile sources.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| CMake 3.10 | active | — | — |
| CMake 3.16 | active | — | — |
| CMake 3.22 | active | — | — |
| CMake 3.27 | active | — | — |

## Workarounds

1. **Remove SOURCES from the INTERFACE library. If you need compiled sources, use add_library(mylib STATIC ...) or add_library(mylib SHARED ...) instead.** (90% success)
   ```
   Remove SOURCES from the INTERFACE library. If you need compiled sources, use add_library(mylib STATIC ...) or add_library(mylib SHARED ...) instead.
   ```
2. **If you need both interface properties and compiled sources, create two targets: an INTERFACE library for headers and a STATIC/SHARED library for sources, then link them.** (85% success)
   ```
   If you need both interface properties and compiled sources, create two targets: an INTERFACE library for headers and a STATIC/SHARED library for sources, then link them.
   ```

## Dead Ends

- **Adding SOURCES property with set_property(TARGET mylib PROPERTY SOURCES ...) to work around the error** — INTERFACE libraries are header-only or pure-interface; they have no compiled sources, so setting SOURCES violates the target type. (95% fail)
- **Changing the target type to STATIC or SHARED but keeping the same interface logic** — Changing target type changes the build semantics; INTERFACE libraries are intended for header-only or transitive dependencies, not compiled code. (70% fail)
- **Deleting the target entirely and re-adding it with sources as a different target** — This loses the interface propagation properties and may break dependency chains. (80% fail)
