-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindGeogram.cmake
144 lines (115 loc) · 4.32 KB
/
FindGeogram.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
134
135
136
137
138
139
140
141
142
143
144
# Find Geogram
# ------------
#
# Find Geogram include dirs and libraries
#
# This module defines the following variables:
#
# Geogram_FOUND - True if geogram has been found.
# Geogram::geogram - Imported target for the main Geogram library.
# Geogram::geogram_gfx - Imported target for Geogram graphics library.
#
# This module reads hints about the Geogram location from the following
# environment variables:
#
# GEOGRAM_INSTALL_PREFIX - Directory where Geogram is installed.
#
# Authors: Jeremie Dumas
# Pierre Moulon
# Bruno Levy
set (GEOGRAM_SEARCH_PATHS
${GEOGRAM_INSTALL_PREFIX}
"$ENV{GEOGRAM_INSTALL_PREFIX}"
"/usr/local/"
"$ENV{PROGRAMFILES}/Geogram"
"$ENV{PROGRAMW6432}/Geogram"
)
set (GEOGRAM_SEARCH_PATHS_SYSTEM
"/usr/lib"
"/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}"
)
find_path (GEOGRAM_INCLUDE_DIR
geogram/basic/common.h
PATHS ${GEOGRAM_SEARCH_PATHS}
PATH_SUFFIXES include/geogram1
)
find_library (GEOGRAM_LIBRARY
NAMES geogram
PATHS ${GEOGRAM_SEARCH_PATHS}
PATH_SUFFIXES lib
)
find_library (GEOGRAM_GFX_LIBRARY
NAMES geogram_gfx
PATHS ${GEOGRAM_SEARCH_PATHS}
PATH_SUFFIXES lib
)
# This one we search in both Geogram search path and
# system search path since it may be already installed
# in the system
find_library (GEOGRAM_GLFW3_LIBRARY
NAMES glfw3 glfw geogram_glfw3 glfw3dll glfwdll
PATHS ${GEOGRAM_SEARCH_PATHS} ${GEOGRAM_SEARCH_PATHS_SYSTEM}
PATH_SUFFIXES lib
)
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(
Geogram DEFAULT_MSG GEOGRAM_LIBRARY GEOGRAM_INCLUDE_DIR
)
# Create an imported target for Geogram
If (GEOGRAM_FOUND)
set(GEOGRAM_INSTALL_PREFIX ${GEOGRAM_INCLUDE_DIR}/../..)
if (NOT TARGET Geogram::geogram)
add_library (Geogram::geogram UNKNOWN IMPORTED)
# Interface include directory
set_target_Properties(Geogram::geogram PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GEOGRAM_INCLUDE_DIR}"
)
# Link to library file
Set_Target_Properties(Geogram::geogram PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GEOGRAM_LIBRARY}"
)
endif ()
if (NOT TARGET Geogram::geogram_gfx)
add_library (Geogram::geogram_gfx UNKNOWN IMPORTED)
set_target_properties(Geogram::geogram_gfx PROPERTIES
INTERFACE_LINK_LIBRARIES ${GEOGRAM_GLFW3_LIBRARY}
)
# Interface include directory
set_target_properties(Geogram::geogram_gfx PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GEOGRAM_INCLUDE_DIR}"
)
# Link to library file
set_target_properties(Geogram::geogram_gfx PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GEOGRAM_GFX_LIBRARY}"
)
endif ()
endif ()
# Hide variables from the default CMake-Gui options
mark_as_advanced (GEOGRAM_LIBRARY GEOGRAM_GFX_LIBRARY GEOGRAM_INCLUDE_DIR)
# Some specific settings for Windows
if(WIN32)
# Default mode for Windows uses static libraries. Use this variable to
# link with geogram compiled as DLLs.
set(VORPALINE_BUILD_DYNAMIC FALSE CACHE BOOL "Installed Geogram uses DLLs")
# remove warning for multiply defined symbols (caused by multiple
# instanciations of STL templates)
add_definitions(/wd4251)
# remove all unused stuff from windows.h
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-DVC_EXTRALEAN)
# do not define a min() and a max() macro, breaks
# std::min() and std::max() !!
add_definitions(-DNOMINMAX )
# we want M_PI etc...
add_definitions(-D_USE_MATH_DEFINES)
if(NOT VORPALINE_BUILD_DYNAMIC)
# If we use static library, we link with the static C++ runtime.
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${config} config)
string(REPLACE /MD /MT CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
string(REPLACE /MD /MT CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
endforeach()
endif()
endif()