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>
This commit is contained in:
Torsten Rasmussen 2022-12-01 11:40:24 +01:00 committed by Carles Cufí
commit 0b845cd28c

View file

@ -78,12 +78,8 @@ if("XTOOLS" IN_LIST Deprecated_FIND_COMPONENTS)
"Please set ZEPHYR_TOOLCHAIN_VARIANT to 'zephyr'") "Please set ZEPHYR_TOOLCHAIN_VARIANT to 'zephyr'")
endif() 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) if("SOURCES" IN_LIST Deprecated_FIND_COMPONENTS)
list(REMOVE_ITEM Deprecated_FIND_COMPONENTS SOURCES)
if(SOURCES) if(SOURCES)
message(DEPRECATION message(DEPRECATION
"Setting SOURCES prior to calling find_package() for unit tests is deprecated." "Setting SOURCES prior to calling find_package() for unit tests is deprecated."
@ -92,5 +88,10 @@ if("SOURCES" IN_LIST Deprecated_FIND_COMPONENTS)
endif() endif()
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)
set(DEPRECATED_FOUND True) set(DEPRECATED_FOUND True)