summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/CMake/PreventInSourceBuild.cmake
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-11-30 17:48:47 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-11-30 17:48:47 +0300
commit0ece30dc7c0e34b4c5911969b8fa99c33c6d023c (patch)
tree671325d3fec09b999411e4e3ab84ef8259261818 /protocols/Telegram/tdlib/td/CMake/PreventInSourceBuild.cmake
parent46c53ffc6809c67e4607e99951a2846c382b63b2 (diff)
Telegram: update for TDLIB
Diffstat (limited to 'protocols/Telegram/tdlib/td/CMake/PreventInSourceBuild.cmake')
-rw-r--r--protocols/Telegram/tdlib/td/CMake/PreventInSourceBuild.cmake14
1 files changed, 14 insertions, 0 deletions
diff --git a/protocols/Telegram/tdlib/td/CMake/PreventInSourceBuild.cmake b/protocols/Telegram/tdlib/td/CMake/PreventInSourceBuild.cmake
new file mode 100644
index 0000000000..1815e82a25
--- /dev/null
+++ b/protocols/Telegram/tdlib/td/CMake/PreventInSourceBuild.cmake
@@ -0,0 +1,14 @@
+function(prevent_in_source_build)
+ get_filename_component(REAL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH)
+ get_filename_component(REAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" REALPATH)
+
+ if (REAL_BINARY_DIR STREQUAL REAL_SOURCE_DIR)
+ message(" Out-of-source build must be used. Remove the files already")
+ message(" created by CMake and rerun CMake from a new directory:")
+ message(" rm -rf CMakeFiles CMakeCache.txt")
+ message(" mkdir build")
+ message(" cd build")
+ message(" cmake ..")
+ message(FATAL_ERROR "In-source build failed.")
+ endif()
+endfunction()