diff --git a/cmake/modules/FindDeprecated.cmake b/cmake/modules/FindDeprecated.cmake index 35d69875149..c2582474b2c 100644 --- a/cmake/modules/FindDeprecated.cmake +++ b/cmake/modules/FindDeprecated.cmake @@ -78,12 +78,8 @@ if("XTOOLS" IN_LIST Deprecated_FIND_COMPONENTS) "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 @@ if("SOURCES" IN_LIST Deprecated_FIND_COMPONENTS) 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)