Prevent in-source build.

GitOrigin-RevId: 36bfc1412dd550bdd2fc6744620014332f82cbb9
This commit is contained in:
levlam 2018-03-04 04:23:52 +03:00
parent 72908f6056
commit a4817a41a3

View File

@ -2,6 +2,21 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(TDLib VERSION 1.1.4 LANGUAGES CXX C)
# Prevent in-source build
get_filename_component(TD_REAL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH)
get_filename_component(TD_REAL_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" REALPATH)
if (TD_REAL_BINARY_DIR STREQUAL TD_REAL_SOURCE_DIR)
message(" Out-of-source build should be used to build TDLib.")
message(" You need to remove the files already created by CMake and")
message(" 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()
option(TD_ENABLE_JNI "Use \"ON\" to enable JNI-compatible TDLib API.")
option(TD_ENABLE_DOTNET "Use \"ON\" to enable generation of C++/CLI or C++/CX TDLib API bindings.")