On Fri, 2019-05-31 at 19:07 +0200, Steven Truppe wrote:
> The problem is the line:
> if(${_var} MATCHES "^WITH_LIB_([AZaz]+)$")
> cmake_print_variables(CMAKE_MATCH_0)
>
> doesn't print me any output ...
There are two problems with the following line:
if(${_var} MATCHES "^WITH_LIB_([AZaz]+)$")
The first argument should be _var instead of ${_var}. See the if()
documentation for more information:
https://cmake.org/cmake/help/v3.14/command/if.html#variable-expansion
The second problem is your regex. I'm guessing you were trying to do:
^WITH_LIB_([A-Za-z]+)$
Notice the hyphens in the character class brackets. This will get you
every character from A to Z and from a to z. Using just [AZaz] will
only match A, Z, a, and z (none of the letters in between.)
So, if you use the following instead:
if(_var MATCHES "^WITH_LIB_([A-Za-z]+)$")
cmake_print_variables(CMAKE_MATCH_0)
this should do what you want.
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