source_group: ensure that passed file is not a directory

Fixes: #19769
Status Name Job ID Coverage
  External
passed cdash

passed cmake-dash3win10-windows-release-ninja

00:20:22

passed cmake-hythloth-linux-debug-makefiles+sphinx

passed cmake-minoc-linux-release-lint-iwyu-tidy

00:14:07

passed cmake-moonshade-osx-debug-ninja

00:15:27

passed cmake-moonshade-osx-release-makefiles

passed cmake-terfin-windows-release-vs2019

passed ghostflow-check-master

passed ghostflow-stager

passed cmake-hythloth-linux-debug-makefiles+sphinx

00:45:31

passed cmake-hythloth-linux-debug-makefiles+sphinx

passed cmake-moonshade-osx-release-makefiles

00:14:23

passed cmake-terfin-windows-release-vs2019

00:37:14

passed cmake-terfin-windows-release-vs2019

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager

passed ghostflow-stager