diff options
Diffstat (limited to 'common/spi/flash_reg/CMakeLists.txt')
-rw-r--r-- | common/spi/flash_reg/CMakeLists.txt | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/spi/flash_reg/CMakeLists.txt b/common/spi/flash_reg/CMakeLists.txt index 55708ac57e..fda467d2e4 100644 --- a/common/spi/flash_reg/CMakeLists.txt +++ b/common/spi/flash_reg/CMakeLists.txt @@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 3.20.0) # Create the library if(BOARD STREQUAL unit_testing) - find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) add_library(spi_flash_reg) else() zephyr_library_named(spi_flash_reg) @@ -46,8 +45,11 @@ target_include_directories(spi_flash_reg PUBLIC public) if(BOARD STREQUAL unit_testing) project(flash_reg) - # Set the sources for the test - target_sources(testbinary PRIVATE src/spi_flash_reg_test.c) + # Set the sources for the test (must be done before find_package) + set(SOURCES src/spi_flash_reg_test.c) + + # Create the unittest libraries and binary + find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE}) # Link the library being tested target_link_libraries(testbinary PRIVATE spi_flash_reg) |