cmake: update FindDeprecated for SOURCES

PR#51049 deprecated SOURCES but placed it below the
Deprecated_FIND_COMPONENTS check causing following message to be printed
when building for the unit_testing board:
-- The following deprecated component(s) could not be found: SOURCES

Fix this by placing the deprecated SOURCES handling at proper location
and append SOURCES to Deprecated_FIND_COMPONENTS list.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
diff --git a/cmake/modules/FindDeprecated.cmake b/cmake/modules/FindDeprecated.cmake
index 35d6987..c258247 100644
--- a/cmake/modules/FindDeprecated.cmake
+++ b/cmake/modules/FindDeprecated.cmake
@@ -78,12 +78,8 @@
                       "Please set ZEPHYR_TOOLCHAIN_VARIANT to 'zephyr'")
 endif()
 
-if(NOT "${Deprecated_FIND_COMPONENTS}" STREQUAL "")
-  message(STATUS "The following deprecated component(s) could not be found: "
-                 "${Deprecated_FIND_COMPONENTS}")
-endif()
-
 if("SOURCES" IN_LIST Deprecated_FIND_COMPONENTS)
+  list(REMOVE_ITEM Deprecated_FIND_COMPONENTS SOURCES)
   if(SOURCES)
     message(DEPRECATION
         "Setting SOURCES prior to calling find_package() for unit tests is deprecated."
@@ -92,5 +88,10 @@
   endif()
 endif()
 
+if(NOT "${Deprecated_FIND_COMPONENTS}" STREQUAL "")
+  message(STATUS "The following deprecated component(s) could not be found: "
+                 "${Deprecated_FIND_COMPONENTS}")
+endif()
+
 set(Deprecated_FOUND True)
 set(DEPRECATED_FOUND True)