Published on

TIL: CMake uses -NOTFOUND for boolean False

CMake has a... unique approach to booleans. Any value that ends with -NOTFOUND evaluates to False.

False if the constant is 0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND.

set(some_var xyz-NOTFOUND)
if(NOT some_var)
    message(STATUS "It's-a me, falsio!")
endif()

Source: Everything You Never Wanted to Know About CMake (Redux)