From c76a6820696f94d49dca171334745de12cb6666e Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 31 Jul 2025 01:57:36 +0500 Subject: [PATCH] CMake: Error out if source directory if `src/` instead of top-level dir --- CMakeLists.txt | 4 +++- src/CMakeLists.txt | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dd83523f..5cffe031f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,7 +221,7 @@ if(NOT EMU_BUILD_NUM) set(EMU_BUILD_NUM 0) endif() if(NOT EMU_COPYRIGHT_YEAR) - set(EMU_COPYRIGHT_YEAR 2024) + set(EMU_COPYRIGHT_YEAR 2025) endif() # Libasan @@ -230,4 +230,6 @@ if(LIBASAN) add_link_options(-fsanitize=address) endif() +set(CMAKE_TOP_LEVEL_PROCESSED TRUE) + add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c77af8256..724e1fda6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,10 @@ # Copyright 2024 Jasmine Iwanek. # +if(NOT CMAKE_TOP_LEVEL_PROCESSED) + message(FATAL_ERROR "Incorrect source directory specified. Delete your build directory and retry with the top-level directory instead") +endif() + if(APPLE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) endif()