Re: [CMake] General question about regex

2019-06-04 Thread Steven Truppe

Thanks alot. My other problem i have no how can i loop over the result,
there are just variables and ${CMAKE_CATCH_COUNT) what command can i use
the iterate over the result ??


best regrads!

On 04.06.19 19:22, Kyle Edwards wrote:

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


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question about regex

2019-06-04 Thread Kyle Edwards via CMake
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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question about regex

2019-06-04 Thread Steven Truppe

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 ?


On 04.06.19 18:47, Kornel Benko wrote:

Am Dienstag, 4. Juni 2019, 18:10:19 CEST schrieb Steven Truppe:

Hello again,


i've the following variable defined:

set(WITH_LIB_GLAD_EXAMPLE_BASIC 1)

And the if the line


foreach(_var VARIABLES)

  if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)")

  message(STATUS "Found a match")

endforeach()


I never get the message "Found match", what am i doing wrong here ??



What about the attached?

Kornel

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question about regex

2019-06-04 Thread Kornel Benko
Am Dienstag, 4. Juni 2019, 18:10:19 CEST schrieb Steven Truppe:
> Hello again,
> 
> 
> i've the following variable defined:
> 
> set(WITH_LIB_GLAD_EXAMPLE_BASIC 1)
> 
> And the if the line
> 
> 
> foreach(_var VARIABLES)
> 
>  if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)")
> 
>  message(STATUS "Found a match")
> 
> endforeach()
> 
> 
> I never get the message "Found match", what am i doing wrong here ??
> 
> 

What about the attached?

Kornel
set(WITH_LIB_GLAD_EXAMPLE_BASIC 1)

get_cmake_property(_variableNames VARIABLES)
foreach(_var ${_variableNames})

 message(STATUS "_var = ${_var}")
 if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)")

 message(STATUS "Found a match")
endif()

endforeach()



signature.asc
Description: This is a digitally signed message part.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake