Best way to check with CMake whether list containts a specific entry

前端 未结 4 1285
粉色の甜心
粉色の甜心 2021-02-06 21:26

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()
         


        
4条回答
  •  误落风尘
    2021-02-06 21:55

    Fewer lines:

    if (";${ARGN};" MATCHES ";bar;")
      #  ...
    endif()
    

    But see the IN_LIST syntax from @sakra for a more-modern syntax.

提交回复
热议问题