-
Notifications
You must be signed in to change notification settings - Fork 1
/
FindRegex.cmake
49 lines (36 loc) · 1.23 KB
/
FindRegex.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# - Try to find the Regex library
#
# Once done this will define
#
# REGEX_FOUND - system has libregex
# REGEX_INCLUDE_DIR - the libregex include directory
# REGEX_LIBRARIES - Link these to use libregex
#
# Copyright (c) 2018, Gilles Caulier, <caulier dot gilles at gmail dot com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if ( NOT MSVC AND NOT MINGW AND NOT MSYS )
find_path(Regex_INCLUDE_DIR
NAMES regex.h
DOC "libregex include directory"
)
mark_as_advanced(Regex_INCLUDE_DIR)
find_library(Regex_LIBRARY "regex"
DOC "libregex libraries"
)
mark_as_advanced(Regex_LIBRARY)
find_package_handle_standard_args(Regex
FOUND_VAR Regex_FOUND
REQUIRED_VARS Regex_INCLUDE_DIR
FAIL_MESSAGE "Failed to find libregex"
)
if(REGEX_FOUND)
set(REGEX_INCLUDE_DIRS ${Regex_INCLUDE_DIRS})
if(Regex_LIBRARY)
set(REGEX_LIBRARIES ${Regex_LIBRARY})
else()
unset(REGEX_LIBRARIES)
endif()
endif()
endif()