Merge pull request #8302 from davidhorstmann-arm/cmake-fix-3rdparty-custom-config-2.28

[Backport 2.28] CMake: fix build with 3rdparty module enabled through a custom config