# Does the CPack IFW Generator always include the module CPackIFW?

**URL:** <https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615>\
**Category:** Code\
**Created:** [February 11, 2020, 4:22pm UTC](https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615 "2020-02-11T16:22:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwuttke](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Post date:** [February 11, 2020, 4:22pm UTC](https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615/1 "2020-02-11T16:22:19Z")

</div>

The doc page “CPack IFW Generator”, section “Hints”, says:

“Generally, the CPack `IFW` generator automatically finds QtIFW tools …”

Does that imply that the IFW generator always includes the module CPackIFW?

---

<div class="post-metadata">

**Author:** ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)\
**Post date:** [February 11, 2020, 4:52pm UTC](https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615/2 "2020-02-11T16:52:16Z")

</div>

Yes, CPackIFW is always included in the IFW generator. IFW generator is part of CMake. Both the generator and the module cannot be extended or replaced. But this is not what the hint sais.

> [@jwuttke](#):
>
> Does that imply that the IFW generator always includes the module CPackIFW?

The hint sais that CMake automatically finds QtIFW tools if they are installed on a default location on your machine. Otherwise you **have to** define an appropriate CMake or an environment variable.

---

<div class="post-metadata">

**Author:** ![jwuttke](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Post date:** [February 11, 2020, 5:02pm UTC](https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615/3 "2020-02-11T17:02:26Z")

</div>

Thank you & excuse me please: I am still confused.

Would it make sense to have the following three lines in a `CMakeLists.txt`:  
`
set(CPACK_GENERATOR IFW)
include(CPack)
include(CPackIFW)
`  
Or is the third line always redundant? When is `CPackIFW` automatically included: when running `cmake` or when running `cpack -G IFW`? When should the presence of QtIFW tools be checked: at `cmake` or at `cpack` time? Would the generator even notice location variables set at `cmake` time?

---

<div class="post-metadata">

**Author:** ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)\
**Post date:** [February 11, 2020, 5:31pm UTC](https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615/4 "2020-02-11T17:31:27Z")

</div>

@jwuttke Yes,

By the first line you define the package generators you would like to use.  
The second line makes use of the packaging functionality. It provides many generators like zip, tgz, etc.  
The third line includes CPackIFW, this is a helper package for QtIFW tools. You could certainly manually set all configurations on CPack without including CPackIFW. CPackIFW is not essential to work with CPack and QtIFW tools, it simply makes live easier.

The 3rd line can be redundant, if you invest enough work into making it redundant.  
CPackIFW is always included at configure time for CMake. To do that automatically CPackIFW must be used. To do it manually CPackIFW cannot be used (because you are being fancy and deliberately chose **not** to 😉). Package is automatically dependent on build, so even if you do not build your project and run `cmake --build . --target package` it is going to build your project first.

If you run `cpack -G IFW` it will be a failure because the files to package do not exist. You have to **build** your project first!

No, the generator does not notice location variables set with CMake. Doing that is CMake’s job, you do not need to worry about it. CMake provides all information for the generator at configure time in a way the generator understands.

**Conclusion** : `CPackIFW` is an interface for QtIFW tools. You can focus on CMake and do not need to worry about how QtIFW works. Without `CPackIFW` you need to know how QtIFW tools work and make an interface for CMake.

---

<div class="post-metadata">

**Author:** ![jwuttke](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/9dc877/32.png) [@jwuttke](https://discourse.cmake.org/u/jwuttke)\
**Post date:** [February 13, 2020, 11:00am UTC](https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615/6 "2020-02-13T11:00:51Z")

</div>

Empirically, I cannot confirm. After removing `include(CPackIFW)` from `CMakeLists.txt`, leaving only `set(CPACK_GENERATOR "IFW")` and `include(CPack)`, the commands `cmake ..; make; cpack` still generate a Qt installer.

And even after removing the `set` command from `CMakeLists.txt`, the commands `cmake ..; make; cpack -G IFW` still generate a Qt installer.

So I see no need for explicitly including the `CPackIFW`module.

---

<div class="post-metadata">

**Author:** ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)\
**Post date:** [February 13, 2020, 8:48pm UTC](https://discourse.cmake.org/t/does-the-cpack-ifw-generator-always-include-the-module-cpackifw/615/7 "2020-02-13T20:48:33Z")

</div>

The `CPackIFW` module provides a number of commands, such as `cpack_ifw_configure_component()`, `cpack_ifw_configure_component_group()`, `cpack_ifw_add_repository()` etc. If you want to call these functions, you should include the `CPackIFW` module.
