CPack script not recognizing CMAKE_BINARY_DIR

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.