On 06/05/2014 10:46 AM, abid rahman wrote:
For example, I want to check if a string is either "abc" or "xyz". How
can I check it?

IF(string1 MATCHES "abc\|xyz" doesn't work?

For the exact string (not substring):

  if(string1 MATCHES "^(abc|xyz)$")

Or without regex:

  if(string1 STREQUAL abc OR string1 STREQUAL xyz)

Nils
--

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:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to