# Is FindPackageHandleStandardArgs included by default in find modules?

**URL:** https://discourse.cmake.org/t/is-findpackagehandlestandardargs-included-by-default-in-find-modules/7336
**Category:** Usage
**Created:** [January 27, 2023, 11:54am UTC](https://discourse.cmake.org/t/is-findpackagehandlestandardargs-included-by-default-in-find-modules/7336 "2023-01-27T11:54:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dundargoc](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dundargoc/32/1923_2.png) [@dundargoc](https://discourse.cmake.org/u/dundargoc)
#### Post date: [January 27, 2023, 11:54am UTC](https://discourse.cmake.org/t/is-findpackagehandlestandardargs-included-by-default-in-find-modules/7336/1 "2023-01-27T11:54:40Z")

</div>

I’m using the following find module in my project:

```auto
find_path(LIBVTERM_INCLUDE_DIR vterm.h)
find_library(LIBVTERM_LIBRARY vterm)

find_package_handle_standard_args(libvterm
  REQUIRED_VARS LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY)

add_library(libvterm INTERFACE)
target_include_directories(libvterm SYSTEM BEFORE INTERFACE INTERFACE ${LIBVTERM_INCLUDE_DIR})
target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY})

```

I then realized that this works just fine even if I don’t include `FindPackageHandleStandardArgs`. This begs the question: is including FindPackageHandleStandardArgs ever necessary?

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [January 27, 2023, 12:28pm UTC](https://discourse.cmake.org/t/is-findpackagehandlestandardargs-included-by-default-in-find-modules/7336/2 "2023-01-27T12:28:22Z")

</div>

Yes, it is necessary to include the module before using it.

In your case, by chance, `FindPackageHandleStandardArgs` was already included by some other module. But to ensure the correct behavior of your module in all situations, including `FindPackageHandleStandardArgs` is required.

---

<div class="post-metadata">

### Author: ![dundargoc](https://discourse.cmake.org/user_avatar/discourse.cmake.org/dundargoc/32/1923_2.png) [@dundargoc](https://discourse.cmake.org/u/dundargoc)
#### Post date: [January 27, 2023, 1:37pm UTC](https://discourse.cmake.org/t/is-findpackagehandlestandardargs-included-by-default-in-find-modules/7336/3 "2023-01-27T13:37:46Z")

</div>

Wow, so find modules does not have their own scope. I see. OK, thanks for the help.

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [January 27, 2023, 1:43pm UTC](https://discourse.cmake.org/t/is-findpackagehandlestandardargs-included-by-default-in-find-modules/7336/4 "2023-01-27T13:43:35Z")

</div>

`CMake` commands are **always** global.

And modules don’t have, by default, a scope for variables or policies, but it is easy to manage one with the commands [block()](https://cmake.org/cmake/help/latest/command/block.html) and [endblock()](https://cmake.org/cmake/help/latest/command/endblock.html).
