zephyr/tests/lib/cmsis_dsp/matrix/CMakeLists.txt
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00

45 lines
922 B
CMake

# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(cmsis_dsp_matrix)
FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE src/main.c)
target_sources_ifdef(
CONFIG_CMSIS_DSP_TEST_MATRIX_UNARY_Q15
app PRIVATE src/unary_q15.c
)
target_sources_ifdef(
CONFIG_CMSIS_DSP_TEST_MATRIX_UNARY_Q31
app PRIVATE src/unary_q31.c
)
target_sources_ifdef(
CONFIG_CMSIS_DSP_TEST_MATRIX_UNARY_F32
app PRIVATE src/unary_f32.c
)
target_sources_ifdef(
CONFIG_CMSIS_DSP_TEST_MATRIX_UNARY_F64
app PRIVATE src/unary_f64.c
)
target_sources_ifdef(
CONFIG_CMSIS_DSP_TEST_MATRIX_BINARY_Q15
app PRIVATE src/binary_q15.c
)
target_sources_ifdef(
CONFIG_CMSIS_DSP_TEST_MATRIX_BINARY_Q31
app PRIVATE src/binary_q31.c
)
target_sources_ifdef(
CONFIG_CMSIS_DSP_TEST_MATRIX_BINARY_F32
app PRIVATE src/binary_f32.c
)