How to fix CMake: Could NOT find Poco

Problem:

When trying to compile a CMake project using cmake . or a similar command, you see the following error message:

CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Poco (missing: Poco_INCLUDE_DIR Poco_LIBRARIES Net
  Foundation)
Call Stack (most recent call first):
  /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindPoco.cmake:27 (find_package_handle_standard_args)
  CMakeLists.txt:40 (find_package)


-- Configuring incomplete, errors occurred!

Solution

You need to install the poco libraries (in that particular case, the libpoco-net and libpoco-foundation) and their respective development packages.

On Ubuntu, use:

sudo apt -y install libpoco-dev

to install all poco libraries and their development headerss