# Struggeling to create a FindWebP.cmake file

**URL:** <https://discourse.cmake.org/t/struggeling-to-create-a-findwebp-cmake-file/9729>\
**Category:** Code\
**Created:** [December 29, 2023, 12:11am UTC](https://discourse.cmake.org/t/struggeling-to-create-a-findwebp-cmake-file/9729 "2023-12-29T00:11:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MickeyKnox](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/a4c791/32.png) [@MickeyKnox](https://discourse.cmake.org/u/MickeyKnox)\
**Post date:** [December 29, 2023, 12:11am UTC](https://discourse.cmake.org/t/struggeling-to-create-a-findwebp-cmake-file/9729/1 "2023-12-29T00:11:14Z")

</div>

I tried to follow [this guide](https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#find-modules) but I’m having trouble understanding it. Would I not simply give the path to the library were it is on my system?

I’ve created a file `FindWebP.cmake` with this content:

```
FindWebP
--------

WebP_INCLUDE_DIRS=/opt/local/include/
WebP_LIBRARIES=/opt/local/lib/

```

This doesn’t even produce an error but is completely ignored. Yes, I put the file in the folder that I exported for `CMAKE_MODULE_PATH`.

Reading the guide above it seems like it’s actually a lot more complicated. What’s the point of calling `find_package` again in the `FindWebP.cmake` file?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [December 29, 2023, 1:28am UTC](https://discourse.cmake.org/t/struggeling-to-create-a-findwebp-cmake-file/9729/2 "2023-12-29T01:28:58Z")

</div>

Here’s an example of about how simple it can get. You can probably skip the version extraction logic.

[https://gitlab.kitware.com/vtk/vtk/-/blob/master/CMake/FindGL2PS.cmake](https://gitlab.kitware.com/vtk/vtk/-/blob/master/CMake/FindGL2PS.cmake)

Note that the content you posted isn’t valid CMake code. You can use the `--debug-find` flag when configuring to inspect what’s going on when CMake is searching for such things.
