-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathFindTidy.cmake
More file actions
134 lines (125 loc) · 3.72 KB
/
FindTidy.cmake
File metadata and controls
134 lines (125 loc) · 3.72 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# Find Tidy
# Find the native TIDY includes and library.
# Once done this will define
#
# TIDY_FOUND - True if tidy found.
# TIDY_INCLUDE_DIRS - where to find tidy.h, etc.
# TIDY_LIBRARIES - List of libraries when using tidy.
#
# An includer may set TIDY_ROOT to a Tidy installation root to tell
# this module where to look.
#
# 20180118 - Remove 'tidy5' name, AND 'include/tidy' subdirectory
#
#set(_TIDY_SEARCHES ${CMAKE_INSTALL_PREFIX})
# Search TIDY_ROOT first if it is set.
if (TIDY_ROOT)
set(_TIDY_SEARCH_ROOT PATHS ${TIDY_ROOT})
list(APPEND _TIDY_SEARCHES ${_TIDY_SEARCH_ROOT})
endif()
set( _TIDY_ROOT $ENV{TIDY_ROOT} )
if (_TIDY_ROOT)
list(APPEND _TIDY_SEARCHES ${_TIDY_ROOT})
endif ()
set(TIDY_NAMES tidy)
if (_TIDY_SEARCHES)
# Try each search configuration.
message(STATUS "+++ Search using paths ${_TIDY_SEARCHES}")
if (MSVC)
foreach(search ${_TIDY_SEARCHES})
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATHS ${search}
PATH_SUFFIXES include
)
# search for the STATIC version first
find_library(TIDY_LIBRARY_DBG
NAMES tidysd
PATHS ${search}
PATH_SUFFIXES lib
)
find_library(TIDY_LIBRARY_REL
NAMES tidys
PATHS ${search}
PATH_SUFFIXES lib
)
endforeach()
if (TIDY_LIBRARY_DBG AND TIDY_LIBRARY_REL)
set(TIDY_LIBRARY
debug ${TIDY_LIBRARY_DBG}
optimized ${TIDY_LIBRARY_REL}
)
elseif (TIDY_LIBRARY_REL)
set(TIDY_LIBRARY ${TIDY_LIBRARY_REL} )
endif ()
if (NOT TIDY_LIBRARY)
foreach(search ${_TIDY_SEARCHES})
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATHS ${search}
PATH_SUFFIXES include
)
find_library(TIDY_LIBRARY
NAMES ${TIDY_NAMES}
PATHS ${search}
PATH_SUFFIXES lib
)
endforeach()
endif ()
else ()
foreach(search ${_TIDY_SEARCHES})
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATHS ${search}
PATH_SUFFIXES include
)
if (USE_TIDY_STATIC)
# search for the static
find_library(TIDY_LIBRARY
NAMES tidys
PATHS ${search}
PATH_SUFFIXES lib
)
endif ()
if (NOT TIDY_LIBRARY)
# search for the shared
find_library(TIDY_LIBRARY
NAMES ${TIDY_NAMES}
PATHS ${search}
PATH_SUFFIXES lib
)
endif ()
endforeach()
endif ()
else ()
message(STATUS "+++ Default search with no search paths")
find_path(TIDY_INCLUDE_DIR
NAMES tidy.h
PATH_SUFFIXES include
)
if (USE_TIDY_STATIC)
# search for the static
find_library(TIDY_LIBRARY
NAMES tidys
PATH_SUFFIXES lib
)
endif ()
if (NOT TIDY_LIBRARY)
# search for the shared
find_library(TIDY_LIBRARY
NAMES ${TIDY_NAMES}
PATH_SUFFIXES lib
)
endif ()
endif ()
###mark_as_advanced(TIDY_LIBRARY TIDY_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set TIDY_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIDY REQUIRED_VARS TIDY_LIBRARY TIDY_INCLUDE_DIR
VERSION_VAR TIDY_VERSION_STRING)
if(TIDY_FOUND)
set(TIDY_INCLUDE_DIRS ${TIDY_INCLUDE_DIR})
set(TIDY_LIBRARIES ${TIDY_LIBRARY})
endif()
# eof