PROJECT(test_unassigned) # Variable expansion seems to work SET(foo ${nonexistent}) ADD_EXECUTABLE(bar bar.cc ${nonexistent}) SET(real "Hello There") STRING(LENGTH ${real} real_len) MESSAGE(STATUS "length of string is ${real_len} another ${nonexistent} here") # Test the special keyword SET(secret $ALLOWUNDEF{possibly_empty_var}) # Test overriding variable SET(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) SET(foo ${bar})