# Must CPACK\_BINARY\_\<generator\> be set even if \<generator\> is set through CPACK\_GENERATOR?

**URL:** <https://discourse.cmake.org/t/must-cpack-binary-generator-be-set-even-if-generator-is-set-through-cpack-generator/10645>\
**Category:** Code\
**Created:** [April 12, 2024, 9:14am UTC](https://discourse.cmake.org/t/must-cpack-binary-generator-be-set-even-if-generator-is-set-through-cpack-generator/10645 "2024-04-12T09:14:52Z")\
**Posts on this page:** 3\
**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:** [April 12, 2024, 9:14am UTC](https://discourse.cmake.org/t/must-cpack-binary-generator-be-set-even-if-generator-is-set-through-cpack-generator/10645/1 "2024-04-12T09:14:52Z")

</div>

This code fragment looks somewhat repetitive:

```auto
set(CPACK_BINARY_DRAGNDROP ON)
set(CPACK_GENERATOR "DragNDrop")

```

So line 2 does not make line 1 redundant?

---

<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:** [April 27, 2024, 3:11pm UTC](https://discourse.cmake.org/t/must-cpack-binary-generator-be-set-even-if-generator-is-set-through-cpack-generator/10645/2 "2024-04-27T15:11:31Z")

</div>

The former seems to be an option coming from `include(CPack)` to make it aware of the need for that package type. I think the latter just sets the default if `-G` is not passed to `cpack`.

---

<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:** [April 28, 2024, 5:21am UTC](https://discourse.cmake.org/t/must-cpack-binary-generator-be-set-even-if-generator-is-set-through-cpack-generator/10645/3 "2024-04-28T05:21:17Z")

</div>

I never set the individual `CPACK_BINARY_<generator-type>` variables. I only ever set `CPACK_GENERATOR` to the list of generators I want by default (for when I don’t pass a `-G` option on the `cpack` command line).
