# CMake Error: install(EXPORT "MyTargets" ...) includes target "mylib" more than once in the export set.

- **ID:** `cmake/export-duplicate-target`
- **Domain:** cmake
- **Category:** install_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The same target is listed in multiple install(TARGETS ...) commands that write to the same export set, or a target is added to the same export set via both install and export() calls.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| CMake 3.20 | active | — | — |
| CMake 3.26 | active | — | — |
| CMake 3.28 | active | — | — |

## Workarounds

1. **Consolidate all install(TARGETS) for the same export set into a single install(TARGETS ... EXPORT MyTargets) call listing all targets.** (90% success)
   ```
   Consolidate all install(TARGETS) for the same export set into a single install(TARGETS ... EXPORT MyTargets) call listing all targets.
   ```
2. **Use the NAMESPACE and install(EXPORT) with COMPONENT to split, but ensure each target appears only once per export set.** (80% success)
   ```
   Use the NAMESPACE and install(EXPORT) with COMPONENT to split, but ensure each target appears only once per export set.
   ```

## Dead Ends

- **Remove one of the install(TARGETS) lines entirely** — If that target needs to be installed for both runtime and development, removing one line might break the install step. (35% fail)
- **Use different export names for each install(TARGETS) call** — This creates separate export sets, which may not be what the downstream project expects (they'd need to include both). (25% fail)
