I want to check whether a lists contains a specific entry like in the following code snipplet:
macro(foo) if ($(ARGN} contains \"bar\") ... endif endmacro() >
With CMake 3.3 or later, the if command supports an IN_LIST operator, e.g.:
if
IN_LIST
if ("bar" IN_LIST _list) ... endif()
For older versions of CMake, you can use the built-in list(FIND) function:
list (FIND _list "bar" _index) if (${_index} GREATER -1) ... endif()