cmake config_error ai_generated true

CMake Error: cannot use STATIC and SHARED library together

ID: cmake/static-shared-conflict

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3 active

Root Cause

Mixing static and shared library types causing issues.

generic

Workarounds

  1. 88% success Build both: add_library(foo STATIC) and add_library(foo_shared SHARED)
  2. 90% success Use BUILD_SHARED_LIBS option to let user choose

Dead Ends

Common approaches that don't work:

  1. Make everything STATIC 68% fail

    Large binary, no shared benefits

  2. Make everything SHARED 65% fail

    Deployment complexity