[CMake] General question about regex

Kyle Edwards kyle.edwards at kitware.com
Tue Jun 4 13:22:46 EDT 2019


On Tue, 2019-06-04 at 19:19 +0200, Steven Truppe wrote:
> I found the solution:
>     get_cmake_property(_vars VARIABLES)
>     foreach(_var ${_vars})
>         string(TOUPPER ${lib} lib_upper)
>         if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-
> z]+)$")
> 	        message(STATUS "Number of examples found:
> ${CMAKE_MATCH_COUNT}")
>         	message(STATUS "Number 1 found: ${CMAKE_MATCH_0}")
>         endif()
>     endforeach()
> Now i've two problem - the CMAKE_MATCH_0 contains the hole string and
> not only the part the is in the (), i need only the part from the ()
> - is there another command i can use for this ?

CMAKE_MATCH_1

Kyle


More information about the CMake mailing list