cmake/Tests/RunCMake/GenEx-LIST/check_errors.cmake
2023-07-02 19:51:09 +02:00

14 lines
369 B
CMake

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()