cmake: moved unittest.cmake to Zephyr CMake modules dir

Move the unittest.cmake to the new Zephyr CMake modules dir.

This allows us to have a single Zephyr CMake package and load unittest
module as: 'find_package(Zephyr COMPONENTS unittest)'

This unifies the way Zephyr package is sourced and removes the need for
a dedicated ZephyrUnittest package.

Deprecate the use of: 'find_package(ZephyrUnittest)'

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-12-17 11:43:54 +01:00 committed by Marti Bolivar
commit e4ccde3774
2 changed files with 6 additions and 5 deletions

View file

@ -13,8 +13,12 @@
macro(include_boilerplate location) macro(include_boilerplate location)
list(PREPEND CMAKE_MODULE_PATH ${ZEPHYR_BASE}/cmake/modules) list(PREPEND CMAKE_MODULE_PATH ${ZEPHYR_BASE}/cmake/modules)
if(ZEPHYR_UNITTEST) if(ZEPHYR_UNITTEST)
message(WARNING "The ZephyrUnittest CMake package has been deprecated.\n"
"ZephyrUnittest has been replaced with Zephyr CMake module 'unittest' \n"
"and can be loaded as: 'find_package(Zephyr COMPONENTS unittest)'"
)
set(ZephyrUnittest_FOUND True) set(ZephyrUnittest_FOUND True)
set(BOILERPLATE_FILE ${ZEPHYR_BASE}/subsys/testsuite/unittest.cmake) set(Zephyr_FIND_COMPONENTS unittest)
else() else()
set(Zephyr_FOUND True) set(Zephyr_FOUND True)
endif() endif()
@ -36,10 +40,7 @@ macro(include_boilerplate location)
if(NOT NO_BOILERPLATE) if(NOT NO_BOILERPLATE)
list(LENGTH Zephyr_FIND_COMPONENTS components_length) list(LENGTH Zephyr_FIND_COMPONENTS components_length)
if(DEFINED BOILERPLATE_FILE) if(components_length EQUAL 0)
message("Including boilerplate (${location}): ${BOILERPLATE_FILE}")
include(${BOILERPLATE_FILE} NO_POLICY_SCOPE)
elseif(components_length EQUAL 0)
message("Loading Zephyr default modules (${location}).") message("Loading Zephyr default modules (${location}).")
include(zephyr_default NO_POLICY_SCOPE) include(zephyr_default NO_POLICY_SCOPE)
else() else()