Exclude build directories from cpack source package

I have a basic CMake setup for a project whose sources I want to distribute as an archive. My current CPack config. is as follows

include(InstallRequiredSystemLibraries)

set(CPACK_PACKAGE_NAME bikaya)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md)
set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_VERSION_MINOR})
set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION})
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_SOURCE_DIR}/README.md)

include(CPack)

My first effective run of the cpack command was

$ cd clion-build-uarm
$ cpack
$ cpack -G TGZ --config CPackSourceConfig.cmake

resulting in a bikaya-0.1.0-Source.tar.gz file. Upon inspecting that file, however, I noted that it contained all the stuff in the clion-build-arm/ directory – which I obviously am not intersted in, since this is just a source package.

How do I exclude unwanted files/directories?

Doing an out-of-source build seems to be the way to go here. Alternatively, you may add your build directory to the CPACK_SOURCE_IGNORE_FILES variable.