EXPORT cmake config_error ai_generated true

CMake Error: install EXPORT target conflicts with existing

ID: cmake/export-target-conflict

Also available as: JSON · Markdown
80%Fix Rate
84%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3 active

Root Cause

CMake export/install target name conflicts.

generic

Workarounds

  1. 90% success Use unique namespace for export: install(EXPORT FooTargets NAMESPACE Foo::)
  2. 88% success Check for existing targets before defining: if(NOT TARGET Foo::Bar)

Dead Ends

Common approaches that don't work:

  1. Use FORCE to override 78% fail

    May break dependent projects

  2. Skip install entirely 72% fail

    Package not distributable