# Is it a normal practice to search for a configuration file inside the find module?

**URL:** <https://discourse.cmake.org/t/is-it-a-normal-practice-to-search-for-a-configuration-file-inside-the-find-module/11231>\
**Category:** Code\
**Created:** [July 12, 2024, 8:49pm UTC](https://discourse.cmake.org/t/is-it-a-normal-practice-to-search-for-a-configuration-file-inside-the-find-module/11231 "2024-07-12T20:49:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.cmake.org/u/Daniel)\
**Post date:** [July 12, 2024, 8:49pm UTC](https://discourse.cmake.org/t/is-it-a-normal-practice-to-search-for-a-configuration-file-inside-the-find-module/11231/1 "2024-07-12T20:49:47Z")

</div>

Consider the [FLTK](https://github.com/fltk/fltk/tree/release-1.3.9) library. After building, this library provides only the configuration file without version support(i.e. `FLTKConfig.cmake` only).  
However, in my project I would like to using this library with the minimum version specified(i.e. `find_package(FLTK <verion>)`). Obviously, such a request will fail.  
Therefore, I plan to develop a find module for my project. Inside the module, I will have to search for the configuration file, in a similar way:

```auto
#MyProj/cmake/Modules/FindFLTK.cmake
unset(FLTK_FIND_VERSION_COMPLETE)
find_package(FLTK CONFIG)
find_package_handle_standard_args(FLTK CONFIG_MODE)

```

To be honest, it looks bad because we forget the `FLTK_FIND_VERSION_COMPLETE` variable so that the search is performed without taking into account the requested version, since we want to check it ourselves.

Unfortunately, that the documentation does not guarantee that forgetting just this variable is enough, there are many other [package interface variables](https://cmake.org/cmake/help/latest/command/find_package.html#package-file-interface-variables) exists.

**What is the most idiomatic correct way to solve the described problem**? At a minimum, the trick of forgetting a variable does not look right, since it is not documented.  
I’m new to CMake. So comments from experienced users are welcome.  
Of course, we are talking about modern cmake (3.29 and higher)

---

<div class="post-metadata">

**Author:** ![Daniel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/3ec8ea/32.png) [@Daniel](https://discourse.cmake.org/u/Daniel)\
**Post date:** [July 14, 2024, 2:16pm UTC](https://discourse.cmake.org/t/is-it-a-normal-practice-to-search-for-a-configuration-file-inside-the-find-module/11231/2 "2024-07-14T14:16:26Z")

</div>

@ClausKlein and @craig.scott Please share your opinions. Should I provide any additional information?

---

<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:** [July 15, 2024, 6:03am UTC](https://discourse.cmake.org/t/is-it-a-normal-practice-to-search-for-a-configuration-file-inside-the-find-module/11231/3 "2024-07-15T06:03:51Z")

</div>

I would prepare a MR to solve the installation gap at its source.

Or you may use `FetchContent(FLDK ....)`

See too [CMake fixes · Issue #655 · fltk/fltk · GitHub](https://github.com/fltk/fltk/issues/655)
