forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindPEGTL.cmake
49 lines (44 loc) · 1.57 KB
/
FindPEGTL.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 PEGTL lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(PEGTL 3.1.2)
# to require version 3.1.2 or newer of PEGTL.
#
# Once done this will define
#
# PEGTL_FOUND - system has eigen lib with correct version
# PEGTL_INCLUDE_DIRS - the eigen include directory
# PEGTL_VERSION - eigen version
#
# And the following imported target:
#
# PEGTL::PEGTL
# Copyright (c) 2006, 2007 Montel Laurent, <[email protected]>
# Copyright (c) 2008, 2009 Gael Guennebaud, <[email protected]>
# Copyright (c) 2009 Benoit Jacob <[email protected]>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
find_path(PEGTL_INCLUDE_DIR
NAMES pegtl/version.hpp
PATH_SUFFIXES tao
DOC "Path to PEGTL headers")
mark_as_advanced(PEGTL_INCLUDE_DIR)
if (PEGTL_INCLUDE_DIR)
file(STRINGS "${PEGTL_INCLUDE_DIR}/pegtl/version.hpp" _pegtl_version_header
REGEX "TAO_PEGTL_VERSION")
string(REGEX MATCH "define[ \t]+TAO_PEGTL_VERSION[ \t]+\"([0-9.]+)\"" _pegtl_version_match "${_pegtl_version_header}")
set(PEGTL_VERSION "${CMAKE_MATCH_1}")
unset(_pegtl_version_header)
unset(_pegtl_version_match)
endif ()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PEGTL
REQUIRED_VARS PEGTL_INCLUDE_DIR
VERSION_VAR PEGTL_VERSION)
if (PEGTL_FOUND)
set(PEGTL_INCLUDE_DIRS "${PEGTL_INCLUDE_DIR}")
if (NOT TARGET PEGTL::PEGTL)
add_library(PEGTL::PEGTL INTERFACE IMPORTED)
set_target_properties(PEGTL::PEGTL PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${PEGTL_INCLUDE_DIR}")
endif ()
endif ()