cmake: ZephyrUnittestConfig.cmake added
Adding ZephyrUnittestConfig.cmake and ZephyrUnittestConfigVersion.cmake to allow unittest projects to use find_package to locate ZephyrUnittest. This means that it will be possible to allow users to run CMake without the need to source zephyr-env.sh or run zephyr-env.cmd. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
caf596ef1b
commit
8829e8237a
4 changed files with 20 additions and 4 deletions
|
@ -15,12 +15,14 @@ if(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_LIST_DIR))
|
|||
message(WARNING "\$\{CMAKE_BINARY_DIR\} is different from \$\{CMAKE_CURRENT_LIST_DIR\}, Zephyr config package may not work as expected.")
|
||||
endif()
|
||||
|
||||
message("Zephyr (${CMAKE_CURRENT_LIST_DIR})")
|
||||
message("Zephyr and ZephyrUnitTest (${CMAKE_CURRENT_LIST_DIR})")
|
||||
message("has been added to the user package registry in:")
|
||||
if(WIN32)
|
||||
message("HKEY_CURRENT_USER\\Software\\Kitware\\CMake\\Packages\\Zephyr")
|
||||
message("HKEY_CURRENT_USER\\Software\\Kitware\\CMake\\Packages\\ZephyrUnitTest")
|
||||
else()
|
||||
message("~/.cmake/packages/Zephyr")
|
||||
message("~/.cmake/packages/ZephyrUnitTest")
|
||||
endif()
|
||||
|
||||
export(PACKAGE Zephyr)
|
||||
|
|
|
@ -13,10 +13,17 @@
|
|||
include(${CMAKE_CURRENT_LIST_DIR}/zephyr_package_search.cmake)
|
||||
|
||||
macro(include_boilerplate location)
|
||||
set(Zephyr_FOUND True)
|
||||
if(ZEPHYR_UNITTEST)
|
||||
set(ZephyrUnittest_FOUND True)
|
||||
set(BOILERPLATE_FILE ${ZEPHYR_BASE}/subsys/testsuite/unittest.cmake)
|
||||
else()
|
||||
set(Zephyr_FOUND True)
|
||||
set(BOILERPLATE_FILE ${ZEPHYR_BASE}/cmake/app/boilerplate.cmake)
|
||||
endif()
|
||||
|
||||
if(NOT NO_BOILERPLATE)
|
||||
message("Including boilerplate (${location}): ${ZEPHYR_BASE}/cmake/app/boilerplate.cmake")
|
||||
include(${ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||
message("Including boilerplate (${location}): ${BOILERPLATE_FILE}")
|
||||
include(${BOILERPLATE_FILE} NO_POLICY_SCOPE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
|
4
share/zephyr-package/cmake/ZephyrUnittestConfig.cmake
Normal file
4
share/zephyr-package/cmake/ZephyrUnittestConfig.cmake
Normal file
|
@ -0,0 +1,4 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(ZEPHYR_UNITTEST TRUE)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ZephyrConfig.cmake)
|
|
@ -0,0 +1,3 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/ZephyrConfigVersion.cmake)
|
Loading…
Add table
Add a link
Reference in a new issue