CPack: Package-time configuration scripts
When generating a package CPack will by default include the file ${CMAKE_BINARY_DIR}/CPackProperties.cmake
to get further variables.
If I generate this file myself and place it in that location, the file ends up being clobbered at the end of the configure step.
To reproduce, have a file containing the following:
cmake_minimum_required(VERSION 3.17)
project(ProjectName)
file(WRITE ${CMAKE_BINARY_DIR}/CPackProperties.cmake "message(Sourced \${CMAKE_CURRENT_LIST_FILE})")
include(CPack)
And run:
$ cmake -S . -B build
$ cat build/CPackProperties.cmake
# CPack properties
I would expect the file to contain my message rather than this comment.
Maybe I'm misusing this and I should use a different file instead and set(CPACK_PROPERTIES_FILE)
accordingly and that would work.
Is CMake unconditionally writing this file because it might put some necessary information in there? Should a custom properties file include the default one generated by CMake? Should this actually be used in the first place as the setting is undocumented?