# How to add libuv to CMakeLists.txt?

**URL:** https://discourse.cmake.org/t/how-to-add-libuv-to-cmakelists-txt/10402
**Category:** Usage
**Created:** [March 19, 2024, 6:08am UTC](https://discourse.cmake.org/t/how-to-add-libuv-to-cmakelists-txt/10402 "2024-03-19T06:08:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![HallofFamer](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/f475e1/32.png) [@HallofFamer](https://discourse.cmake.org/u/HallofFamer)
#### Post date: [March 19, 2024, 6:08am UTC](https://discourse.cmake.org/t/how-to-add-libuv-to-cmakelists-txt/10402/1 "2024-03-19T06:08:58Z")

</div>

Well I’ve tried to add libuv to CMakeLists.txt for my project on Ubuntu, with the below code:

```auto
    find_package(libuv REQUIRED)
    target_link_libraries(${PROJECT_NAME} libuv::uv)    

```

And it does not work, instead gave me an error I have no idea how to fix:

```auto
Make Error at CMakeLists.txt:201 (find_package):
  By not providing "Findlibuv.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "libuv", but
  CMake did not find one.

  Could not find a package configuration file provided by "libuv" with any of
  the following names:

    libuvConfig.cmake
    libuv-config.cmake

  Add the installation prefix of "libuv" to CMAKE_PREFIX_PATH or set
  "libuv_DIR" to a directory containing one of the above files. If "libuv"
  provides a separate development package or SDK, be sure it has been
  installed.

```

Does anyone know how I can fix this? The same code worked for curl, so I dont get why it fails to work for libuv.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [March 19, 2024, 10:42am UTC](https://discourse.cmake.org/t/how-to-add-libuv-to-cmakelists-txt/10402/2 "2024-03-19T10:42:22Z")

</div>

> [@HallofFamer](#):
>
> `find_package(libuv REQUIRED)`

There does not exist a `cmake config packages` for libuv!

```bash
bash-5.2$ find /usr/local/lib -name 'libuv*'
/usr/local/lib/libuv.dylib
/usr/local/lib/pkgconfig/libuv.pc
/usr/local/lib/libuv.1.dylib
/usr/local/lib/libuv.a
bash-5.2$ 

```

You have to use [FindPkgConfig](https://cmake.org/cmake/help/latest/module/FindPkgConfig.html#command:pkg_check_modules)
