Minimal CMake if/else/endif example if/else/endif looks like this in CMake: if(myvar) message("if") else() message("else") endif()