# CPack script not recognizing CMAKE\_BINARY\_DIR

**URL:** https://discourse.cmake.org/t/cpack-script-not-recognizing-cmake-binary-dir/2191
**Category:** Code
**Created:** [November 17, 2020, 2:57pm UTC](https://discourse.cmake.org/t/cpack-script-not-recognizing-cmake-binary-dir/2191 "2020-11-17T14:57:27Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [November 17, 2020, 4:27pm UTC](https://discourse.cmake.org/t/cpack-script-not-recognizing-cmake-binary-dir/2191/2 "2020-11-17T16:27:01Z")

</div>

I think that sounds right. Not all CMake variables are transported over to CPack time. Apparently `CMAKE_BINARY_DIR` is one of them. You could `configure_file(@ONLY)` the script and use `@CMAKE_BINARY_DIR@` to have it be replaced at a time when it is known.

---

_[View the full topic](https://discourse.cmake.org/t/cpack-script-not-recognizing-cmake-binary-dir/2191)._
