Reputation: 4946
I know how to generate an error at configuration time with message()
command. But how to use CMake to force my build to fail?
I can think of something using add_custom_command(TARGET MyFailingTarget POST_BUILD COMMAND myFailingCommand) but that seems really hacky.
Upvotes: 0
Views: 981
Reputation: 4946
For the reference, here is what I ended up doing (so similar to what I said in my question):
add_custom_command(TARGET onlyInRelease PRE_BUILD
COMAND $<$<NOT:$<CONFIG:Release>>:TARGET_ALLOWED_FOR_RELEASE_BUILDS_ONLY>)
Upvotes: 0