Ver código fonte

cmake: Forbid in-source builds

Xenofon Karamanos 7 meses atrás
pai
commit
0afea1fd17
1 arquivos alterados com 11 adições e 0 exclusões
  1. 11 0
      CMakeLists.txt

+ 11 - 0
CMakeLists.txt

@@ -10,6 +10,17 @@ project(
   HOMEPAGE_URL "https://www.kamailio.org"
   HOMEPAGE_URL "https://www.kamailio.org"
 )
 )
 
 
+# ---- Include guards ----
+
+if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
+  message(
+    FATAL_ERROR
+      "In-source builds not allowed. Please make a new directory (called a build directory) \
+and run CMake again accordingly.")
+endif()
+
+# ---- Project settings ----
+
 # Set the version number
 # Set the version number
 set(EXTRAVERSION "-dev1")
 set(EXTRAVERSION "-dev1")
 set(RELEASE "${PROJECT_VERSION}${EXTRAVERSION}")
 set(RELEASE "${PROJECT_VERSION}${EXTRAVERSION}")