cmake: create zephyr_get_targets() functions
cmake: create zephyr_get_targets() functions

Fixes: #28197

zephyr_get_targets() provides a mechanism for retrieving all CMake
targets for a given directory and below.

This is useful when including external modules where only libraries
required by Zephyr should be built.

For example, in openthread, this reduces the number of build steps and
build time significantly.

Before, 780 steps:
`time ninja -Cbuild`
[708/708] Linking CXX executable zephyr/zephyr.elf
135.08user 30.24system 0:46.21elapsed 357%CPU

After, 480 steps:
`time ninja -Cbuild`
[480/480] Linking CXX executable zephyr/zephyr.elf
84.02user 18.92system 0:30.72elapsed 335%CPU

Signed-off-by: Torsten Rasmussen <a7c5b1d5a1f41fce6edfa3f7c2392ae0c59deafe@nordicsemi.no>

galak/zephyr,galak/zephyr,galak/zephyr,finikorg/zephyr,nashif/zephyr,galak/zephyr,nashif/zephyr,Vudentz/zephyr,Vudentz/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,finikorg/zephyr,Vudentz/zephyr,nashif/zephyr,finikorg/zephyr,nashif/zephyr,nashif/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,Vudentz/zephyr,finikorg/zephyr,Vudentz/zephyr,galak/zephyr