From 3ba480ba53713afe6c0844e84fa000e5a849e495 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Tue, 7 Apr 2020 17:39:36 +0800 Subject: [PATCH] cmake: error out on building in IDF_PATH root dir --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f87020b52..9e1253663 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required(VERSION 3.5) project(esp-idf C CXX ASM) +if(CMAKE_CURRENT_LIST_DIR STREQUAL CMAKE_SOURCE_DIR) + message(FATAL_ERROR "Current directory '${CMAKE_CURRENT_LIST_DIR}' is not buildable. " + "Change directories to one of the example projects in '${CMAKE_CURRENT_LIST_DIR}/examples' and try " + "again.") +endif() + unset(compile_options) unset(c_compile_options) unset(cxx_compile_options)