cmake
build_error
ai_generated
true
CMake Error: Imported target 'Boost::filesystem' includes non-existent path
ID: cmake/imported-target-not-found
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3 | active | — | — | — |
Root Cause
An imported target references paths that do not exist on disk. Library was moved, uninstalled, or partially installed.
genericWorkarounds
-
92% success Reinstall the dependency that provides the imported target
sudo apt install libboost-filesystem-dev # provides Boost::filesystem target
Sources: https://cmake.org/cmake/help/latest/command/find_package.html
-
90% success Delete CMakeCache.txt AND install the missing library, then reconfigure
rm -rf build/ && sudo apt install libfoo-dev && cmake -B build
-
82% success Set the package DIR variable to the correct install prefix
cmake -DBoost_DIR=/opt/boost/lib/cmake/Boost-1.83.0 ..
Dead Ends
Common approaches that don't work:
-
Create the missing path manually
80% fail
Manually creating library directories does not provide the actual libraries and headers.
-
Remove CMakeCache.txt and assume reconfigure will find it
65% fail
If the library is not installed, reconfiguring still will not find it. Cache removal alone is not a fix.