-
Notifications
You must be signed in to change notification settings - Fork 1
/
FindCGAL.cmake
133 lines (120 loc) · 2.75 KB
/
FindCGAL.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
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
# - Find CGAL
# Find the CGAL includes and client library
#
# This module defines
# CGAL_INCLUDE_DIR, where to find CGAL.h
# CGAL_LIBRARY, the libraries needed to use CGAL.
# CGAL_FOUND, If false, do not try to use CGAL.
#
# Available componenst:
# Core
# ImageIO
#
# Available targets:
# CGAL::CGAL
# CGAL::Core
# CGAL::ImageIO
find_path(CGAL_INCLUDE_DIR CGAL/basic.h
PATHS
ENV CGAL_ROOT
ENV CGAL_INCLUDE_DIR
${CGAL_ROOT}
/usr
/usr/local
$ENV{HOME}/.local
PATH_SUFFIXES
include
)
find_library(CGAL_LIBRARY
NAMES
CGAL
PATHS
ENV CGAL_ROOT
ENV CGAL_LIB_DIR
${CGAL_ROOT}
/usr
/usr/local
$ENV{HOME}/.local
PATH_SUFFIXES
lib
)
find_library(CGAL_Core_LIBRARY
NAMES
CGAL_Core
PATHS
ENV CGAL_ROOT
ENV CGAL_LIB_DIR
${CGAL_ROOT}
/usr
/usr/local
$ENV{HOME}/.local
PATH_SUFFIXES
lib
)
if (CGAL_Core_LIBRARY)
set(CGAL_Core_FOUND ON)
endif()
find_library(CGAL_ImageIO_LIBRARY
NAMES
CGAL_ImageIO
PATHS
ENV CGAL_ROOT
ENV CGAL_LIB_DIR
${CGAL_ROOT}
/usr
/usr/local
$ENV{HOME}/.local
PATH_SUFFIXES
lib
)
if (CGAL_ImageIO_LIBRARY)
set(CGAL_ImageIO_FOUND ON)
endif()
mark_as_advanced(
CGAL_INCLUDE_DIR
CGAL_LIBRARY
CGAL_Core_LIBRARY
CGAL_ImageIO_LIBRARY
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CGAL
REQUIRED_VARS
CGAL_INCLUDE_DIR
CGAL_LIBRARY
HANDLE_COMPONENTS
)
if (NOT TARGET Boost::boost OR NOT TARGET Boost::thread)
find_package(Boost REQUIRED COMPONENTS thread)
endif()
if (NOT TARGET MPFR::MPFR)
find_package(MPFR REQUIRED)
endif()
if(CGAL_FOUND)
if(NOT TARGET CGAL::CGAL)
add_library(CGAL::CGAL UNKNOWN IMPORTED)
set_target_properties(CGAL::CGAL PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${CGAL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CGAL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES Boost::boost Boost::thread MPFR::MPFR
)
endif()
if (CGAL_Core_FOUND AND NOT TARGET CGAL::Core)
add_library(CGAL::Core UNKNOWN IMPORTED)
set_target_properties(CGAL::Core PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${CGAL_Core_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CGAL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES Boost::boost Boost::thread MPFR::MPFR
)
endif()
if (CGAL_ImageIO_FOUND AND NOT TARGET CGAL::ImageIO)
add_library(CGAL::ImageIO UNKNOWN IMPORTED)
set_target_properties(CGAL::ImageIO PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${CGAL_ImageIO_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CGAL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES Boost::boost Boost::thread MPFR::MPFR
)
endif()
endif()