summaryrefslogtreecommitdiff
path: root/Tests/RunCMake/GenEx-LIST/check_errors.cmake
blob: 7e60fc725edcd27b8dee238323d55c733ab4f1dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13

function (CHECK_ERRORS command)
  set (errors ${ARGN})
  set (command "$<${command}>")
  if (errors)
    string (LENGTH "${command}" length)
    math (EXPR count "${length} + 2")
    string (REPEAT " " ${count} shift)
    list (TRANSFORM errors PREPEND "${shift}")
    list (JOIN errors "\n" msg)
    message (FATAL_ERROR "${command}: ${msg}")
  endif()
endfunction()