cmake: Improve user error feedback when -H$ZEPHYR_BASE is specified

Users are sometimes mistakenly invoking cmake with $ZEPHYR_BASE set as
the source directory.

This user-error can occur if the user believes that the toplevel
CMakeLists.txt file is at the root of the repo, or if the user uses
the wrong path when invoking cmake.

The error given when this user-error occurs is cryptic and undefined,
so we replace it with what should be an easy-to-understand error
message.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2018-06-04 11:47:45 +02:00 committed by Anas Nashif
parent 1ce6a6eaa8
commit ee9af86f4c

View file

@ -1,3 +1,13 @@
if(NOT DEFINED ZEPHYR_BINARY_DIR)
message(FATAL_ERROR "A user error has occured.
cmake was invoked with '${CMAKE_CURRENT_LIST_DIR}' specified as the source directory,
but it must be invoked with an application source directory,
such as '${CMAKE_CURRENT_LIST_DIR}/samples/hello_world'.
Debug variables:
CMAKE_CACHEFILE_DIR: ${CMAKE_CACHEFILE_DIR}
")
endif()
project(Zephyr-Kernel VERSION ${PROJECT_VERSION})
enable_language(C CXX ASM)