How to manually set a CMake path variable to NOTFOUND?

Viewed 78

I'm hardcoding a library path before hand and want to set the path to NOTFOUND manually if the file doesn't exist.

set(MY_LIB "path that doesn't exist")
if(NOT EXISTS "${MY_LIB}")
 message("not found")
 // set it back to NOTFOUND ??
endif()
if (MY_LIB)
 // set flags
endif()
1 Answers

How to manually set a CMake path variable to NOTFOUND?

Just set it to the string:

set(MY_LIB "NOTFOUND")
Related