# Is it possible to retrieve the full path of the cpack package (including the file extension)?

**URL:** https://discourse.cmake.org/t/is-it-possible-to-retrieve-the-full-path-of-the-cpack-package-including-the-file-extension/5765
**Category:** Usage
**Created:** [May 31, 2022, 2:05pm UTC](https://discourse.cmake.org/t/is-it-possible-to-retrieve-the-full-path-of-the-cpack-package-including-the-file-extension/5765 "2022-05-31T14:05:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![raygerlabs](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/4af34b/32.png) [@raygerlabs](https://discourse.cmake.org/u/raygerlabs)
#### Post date: [May 31, 2022, 2:05pm UTC](https://discourse.cmake.org/t/is-it-possible-to-retrieve-the-full-path-of-the-cpack-package-including-the-file-extension/5765/1 "2022-05-31T14:05:52Z")

</div>

Here is an example code. The package\_info.txt file will contain the package name but without the extension and path.

```auto
# Set packaging path
if (NOT CPACK_OUTPUT_FILE_PREFIX)
  set(CPACK_OUTPUT_FILE_PREFIX "${PROJECT_BINARY_DIR}")
endif()
if (NOT CPACK_PACKAGE_DIRECTORY)
  set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}")
endif()

# Set package file name
set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
if (CPACK_PACKAGE_ARCHITECTURE)
  set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${CPACK_PACKAGE_ARCHITECTURE}")
endif()
message(STATUS "CPACK_PACKAGE_FILE_NAME: " ${CPACK_PACKAGE_FILE_NAME})
file(WRITE "${PROJECT_BINARY_DIR}/package_info.txt" "${CPACK_PACKAGE_FILE_NAME}")

```
