MacroEnsureOutOfSourceBuild.cmake 663 B

123456789101112131415161718
  1. # - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
  2. # MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
  3. # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
  4. #
  5. # Redistribution and use is allowed according to the terms of the BSD license.
  6. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  7. macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
  8. string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource)
  9. if (_insource)
  10. message(SEND_ERROR "${_errorMessage}")
  11. message(FATAL_ERROR "Remove the file CMakeCache.txt in ${CMAKE_SOURCE_DIR} first.")
  12. endif (_insource)
  13. endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)