Find and return the first item that matches a substring or regex in a CMake list? - Stack Overflow

I would like to find a path of an .obj file in Cmake using $<TARGET_OBJECTS> (as described in How

I would like to find a path of an .obj file in Cmake using $<TARGET_OBJECTS> (as described in How to get path to object files with CMake for both multiconfiguration generator and makefile based ones?).

I have found How can I check in CMake whether a list contains a specific entry? - however, it seems to me that both

if ("bar" IN_LIST _list)
 ...
endif()

and list (FIND _list "bar" _index) approaches look for strict equality (in this example, one of the list entries must be equal to "bar").

What can I do, to find and return the (first) item in a CMake list which contains a substring (or matches a regex)? A priori I'd only know the filename of the .obj file, e.g. myfile.c.obj - and I'd like to query CMake for its full path.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745118038a4612249.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信