Commit 8829e823 authored by Torsten Rasmussen's avatar Torsten Rasmussen Committed by Carles Cufi
Browse files

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: default avatarTorsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
parent caf596ef
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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)
+10 −3
Original line number Diff line number Diff line
@@ -13,10 +13,17 @@
include(${CMAKE_CURRENT_LIST_DIR}/zephyr_package_search.cmake)

macro(include_boilerplate location)
  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 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

set(ZEPHYR_UNITTEST TRUE)
include(${CMAKE_CURRENT_LIST_DIR}/ZephyrConfig.cmake)
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

include(${CMAKE_CURRENT_LIST_DIR}/ZephyrConfigVersion.cmake)