From: Matthias Maier Date: Sun, 3 Jun 2018 20:32:46 +0000 (-0500) Subject: CMake: add a safeguard for accidential /source source directory X-Git-Tag: v9.1.0-rc1~1076^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=000b46a32741c579d37e711ea14c0aa33ae8a37a;p=dealii.git 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") ``` --- 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 #