How to fix CMake Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES)

Problem

When building your project using cmake ., you see the following warning or error message:

how-to-fix-cmake-could-not-find-libedit-missing-libedit-include-dirs-libedit-libraries_block1.txt
-- Could NOT find LibEdit (missing: LibEdit_INCLUDE_DIRS LibEdit_LIBRARIES)
```plaintext {filename="how-to-fix-cmake-could-not-find-libedit-missing-libedit-include-dirs-libedit-libraries_block2.txt"}

## Solution

This error indicates that CMake is unable to find the LibEdit library, which is a common library for command-line editing and history.

To resolve this issue, install it using

```bash {filename="install_libedit.sh"}
sudo apt install libedit-dev
```plaintext {filename="install_libedit.sh"}

Then, re-run `cmake .` and the error should be resolved.

Check out similar posts by category: CMake, C/C++