From d0a50327233c78e000af70a21e9cd69ef4e82020 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Tue, 17 Jul 2012 19:18:05 +0200 Subject: [PATCH] Add warning for in-source-directory builds. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 623feea5..b4420de0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,14 @@ string(STRIP ${versionFile} SIMGEAR_VERSION) # use simgear version also as the SO version (if building SOs) SET(SIMGEAR_SOVERSION ${SIMGEAR_VERSION}) +# Warning when build is not an out-of-source build. +string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" InSourceBuild) +if(InSourceBuild) + message(WARNING "Avoid building inside the source tree!") + message(WARNING "Create a separate build directory instead (i.e. 'sgbuild') and call CMake from there: ") + message(WARNING " mkdir ../sgbuild && cd ../sgbuild && cmake ${CMAKE_SOURCE_DIR}") +endif(InSourceBuild) + #packaging SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README") -- 2.39.5