This shows you the differences between two versions of the page.
cmake_tips [2018/08/06 19:31] 90.196.61.50 created |
cmake_tips [2018/08/06 19:35] (current) 90.196.61.50 |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Regular expression ====== | ====== Regular expression ====== | ||
- | Example of MATCH | + | Example of MATCH. CMake is a bit weird. The following example would match the file name without extension. |
+ | <code cmake> | ||
+ | string(REGEX MATCH "(.+).c" match ${current_file}) | ||
+ | if (NOT ${match} EQUALS "") | ||
+ | set (current_target ${CMAKE_MATCH_1}) | ||
+ | endif() | ||
+ | </code> |