From 000b46a32741c579d37e711ea14c0aa33ae8a37a Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 3 Jun 2018 15:32:46 -0500 Subject: [PATCH] CMake: add a safeguard for accidential /source source directory This happens remarkably often. Let's improve the error message: ``` Wrong source directory specified. You pointed cmake to the subdirectory "source" instead of the base directory. Make sure that the path in the cmake invocation does not end in source. If you have created a "build" subdirectory, the cmake invocation should simply be of the form: $ cmake [...options...] /.. (path not ending in ".../source") ``` --- source/CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 2704d12c77..9c429dd88f 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -15,6 +15,21 @@ MESSAGE(STATUS "Setting up library") +# +# This happens surprisingly often: +# +IF("${DEAL_II_PACKAGE_NAME}" STREQUAL "") + MESSAGE(FATAL_ERROR + "\nWrong source directory specified.\n" + "You pointed cmake to the subdirectory \"source\" instead of the base " + "directory. Make sure that the path in the cmake invocation does not " + "end in source. If you have created a \"build\" subdirectory, the " + "cmake invocation should simply be of the form:\n" + " $ cmake [...options...] /..\n" + "(path not ending in \".../source\")" + ) +ENDIF() + # # Compile the deal.II library # -- 2.39.5