Mac Installer made with CPack won't install anything

I’m trying out CPack with the ProductBuild generator to decide if my company can use it to ship one of our products on macOS. To experiment, I tried making an installer for a simple “hello, world” program.

At this point, I can make a Mac Installer, but when I run it, it doesn’t actually install anything: after I agree to the license, I’m left with a contents screen that says there is nothing in the installer, and a disabled “Install” button.

My CMakeLists.txt

cmake_minimum_required(VERSION 3.20)
project(HelloWorld VERSION 1.0)
add_executable(helloworld helloworld.cxx)
install(TARGETS helloworld RUNTIME DESTINATION bin)

include(InstallRequiredSystemLibraries)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
set(CPACK_PACKAGE_VERSION_MAJOR "${HelloWorld_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${HelloWorld_VERSION_MINOR}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/Desc.txt")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "helloworld ${VERSION_MAJOR}.${VERSION_MINOR}")
set(CPACK_PACKAGE_EXECUTABLES "helloworld")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "helloworld-${VERSION}${VERSION_SUFFIX}")

set(CPACK_GENERATOR "productbuild")
include(CPack)

I don’t see any obvious errors when running cpack --verbose

This sounds similar to the long-standing issue reported here: https://gitlab.kitware.com/cmake/cmake/-/issues/18201

TLDR: A workaround appears to be to ensure you define an install component with cpack_add_component().