cmake config_error ai_generated true

CMake Error: Imported target 'Boost::filesystem' includes non-existent path '/usr/local/include/boost_1_82'

ID: cmake/imported-target-missing-interface-include-dirs

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2023-09-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
CMake 3.26 active
CMake 3.27 active
Boost 1.82 active
Boost 1.84 active

Root Cause

An imported target's INTERFACE_INCLUDE_DIRECTORIES property references a directory that no longer exists, often due to a moved or removed Boost installation.

generic

中文

导入目标的INTERFACE_INCLUDE_DIRECTORIES属性引用了不再存在的目录,通常是由于Boost安装被移动或删除。

Official Documentation

https://cmake.org/cmake/help/latest/command/add_library.html#imported-libraries

Workarounds

  1. 90% success Delete CMakeCache.txt and rebuild from scratch to refresh imported target properties
    Delete CMakeCache.txt and rebuild from scratch to refresh imported target properties
  2. 70% success Set the missing path to an existing dummy directory using target_include_directories on the imported target
    Set the missing path to an existing dummy directory using target_include_directories on the imported target
  3. 85% success Reinstall Boost to the original location or symlink the missing directory
    Reinstall Boost to the original location or symlink the missing directory

中文步骤

  1. Delete CMakeCache.txt and rebuild from scratch to refresh imported target properties
  2. Set the missing path to an existing dummy directory using target_include_directories on the imported target
  3. Reinstall Boost to the original location or symlink the missing directory

Dead Ends

Common approaches that don't work:

  1. Manually delete the Boost CMake config files and reinstall 40% fail

    The config files may be cached; deletion without clearing CMake cache leads to stale references.

  2. Set BOOST_ROOT to a new path without updating the imported target 60% fail

    BOOST_ROOT only affects find_package; the imported target's properties are cached after first configuration.

  3. Use add_definitions(-DBOOST_ALL_NO_LIB) to bypass library checks 80% fail

    This only disables auto-linking, not the include directory validation.