[CMake] Return an Error Code (or something) from a CMake Script.

FRamold Felix.Ramold at kuka.com
Tue Sep 24 08:16:58 EDT 2019


Hi Michael,

you probably figured this out by now, but for future reference: You have to
log to stderr to make the script fail.

This example works (as in /does not build/ ;) ):

    file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/skript.cmake"
       CONTENT "message(FATAL_ERROR \"Script failed!!\")"
    )
    add_custom_target(runSkript
       COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/skript.cmake
    )

btw: Using CMake 3.10

Greetings,
Felix



--
Sent from: http://cmake.3232098.n2.nabble.com/


More information about the CMake mailing list