0029589: Configuration - allow MFC samples to be built when OCCT is linked statically
[occt.git] / adm / cmake / freetype.cmake
1 # freetype
2
3 if (NOT DEFINED INSTALL_FREETYPE AND BUILD_SHARED_LIBS)
4   set (INSTALL_FREETYPE OFF CACHE BOOL "${INSTALL_FREETYPE_DESCR}")
5 endif()
6
7 if (NOT DEFINED 3RDPARTY_FREETYPE_DIR)
8   set (3RDPARTY_FREETYPE_DIR "" CACHE PATH "The directory containing freetype")
9 endif()
10
11 # include occt macros. compiler_bitness, os_wiht_bit, compiler
12 OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/occt_macros")
13
14 OCCT_MAKE_COMPILER_SHORT_NAME()
15 OCCT_MAKE_COMPILER_BITNESS()
16
17 # specify freetype folder in connectin with 3RDPARTY_DIR
18 if (3RDPARTY_DIR AND EXISTS "${3RDPARTY_DIR}")
19   #CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_DIR 3RDPARTY_FREETYPE_DIR PATH "The directory containing freetype")
20
21   if (NOT 3RDPARTY_FREETYPE_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DIR}")
22     FIND_PRODUCT_DIR ("${3RDPARTY_DIR}" FREETYPE FREETYPE_DIR_NAME)
23     if (FREETYPE_DIR_NAME)
24       set (3RDPARTY_FREETYPE_DIR "${3RDPARTY_DIR}/${FREETYPE_DIR_NAME}" CACHE PATH "The directory containing freetype" FORCE)
25     endif()
26   endif()
27 else()
28   #set (3RDPARTY_FREETYPE_DIR "" CACHE PATH "The directory containing freetype" FORCE)
29 endif()
30
31 # define required freetype variables
32 if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
33   set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build  "" CACHE FILEPATH "the path of ft2build.h")
34 endif()
35
36 if (NOT DEFINED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
37   set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path of freetype2")
38 endif()
39
40 if (BUILD_SHARED_LIBS)
41   if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY OR NOT 3RDPARTY_FREETYPE_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
42     set (3RDPARTY_FREETYPE_LIBRARY               "" CACHE FILEPATH "freetype library" FORCE)
43   endif()
44
45   if (NOT DEFINED 3RDPARTY_FREETYPE_LIBRARY_DIR)
46     set (3RDPARTY_FREETYPE_LIBRARY_DIR           "" CACHE PATH "The directory containing freetype library")
47   endif()
48
49   if (WIN32)
50     if (NOT DEFINED 3RDPARTY_FREETYPE_DLL OR NOT 3RDPARTY_FREETYPE_DLL_DIR OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
51       set (3RDPARTY_FREETYPE_DLL                 "" CACHE FILEPATH "freetype shared library" FORCE)
52     endif()
53   endif()
54
55   if (WIN32)
56     if (NOT DEFINED 3RDPARTY_FREETYPE_DLL_DIR)
57       set (3RDPARTY_FREETYPE_DLL_DIR               "" CACHE PATH "The directory containing freetype shared library")
58     endif()
59   endif()
60 endif()
61
62 # check 3RDPARTY_FREETYPE_ paths for consistency with specified 3RDPARTY_FREETYPE_DIR
63 if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
64   CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
65   CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
66   if (BUILD_SHARED_LIBS)
67     CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY FILEPATH "the path to freetype library")
68
69     if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
70       get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
71       set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
72     else()
73       CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_LIBRARY_DIR PATH "The directory containing freetype library")
74     endif()
75
76     if (WIN32)
77       CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL FILEPATH "the path to freetype shared library")
78
79       if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
80         get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
81         set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype shared library" FORCE)
82       else()
83         CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR 3RDPARTY_FREETYPE_DLL_DIR PATH "The directory containing freetype shared library")
84       endif()
85     endif()
86   endif()
87 endif()
88
89 # the FIRST step in search for freetype library and header folders (built-in search engine)
90
91 # execute built-in search engine to seek freetype
92 set (IS_BUILTIN_SEARCH_REQUIRED OFF)
93 if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
94   set (IS_BUILTIN_SEARCH_REQUIRED ON)
95 elseif (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
96   set (IS_BUILTIN_SEARCH_REQUIRED ON)
97 elseif (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
98   set (IS_BUILTIN_SEARCH_REQUIRED ON)
99 #elseif (WIN32)
100   #if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
101   #  set (IS_BUILTIN_SEARCH_REQUIRED ON)
102   #endif()
103 endif()
104
105 if (IS_BUILTIN_SEARCH_REQUIRED)
106
107   # use 3RDPARTY_FREETYPE_DIR if it is specified for freetype search
108   if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
109     set (CACHED_FREETYPE_DIR $ENV{FREETYPE_DIR})
110     set (ENV{FREETYPE_DIR} "${3RDPARTY_FREETYPE_DIR}")
111   endif()
112
113   find_package(Freetype)
114
115   # restore ENV{FREETYPE_DIR}
116   if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
117     set (ENV{FREETYPE_DIR} ${CACHED_FREETYPE_DIR})
118   endif()
119
120   # check the found paths for consistency with specified 3RDPARTY_FREETYPE_DIR
121   if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
122     CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_ft2build FILEPATH "the path to ft2build.h")
123     CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_INCLUDE_DIR_freetype2 FILEPATH "the path to ftheader.h")
124     if (BUILD_SHARED_LIBS)
125       CHECK_PATH_FOR_CONSISTENCY (3RDPARTY_FREETYPE_DIR FREETYPE_LIBRARY FILEPATH "freetype library")
126     endif()
127   endif()
128
129   # assign the found paths to corresponding 3RDPARTY_FREETYPE_ variables
130   if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
131     if (FREETYPE_INCLUDE_DIR_ft2build AND EXISTS "${FREETYPE_INCLUDE_DIR_ft2build}")
132       set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build  "${FREETYPE_INCLUDE_DIR_ft2build}" CACHE FILEPATH "the path to ft2build.h" FORCE)
133     endif()
134   endif()
135
136   if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
137     if (FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}")
138       set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2  "${FREETYPE_INCLUDE_DIR_freetype2}" CACHE FILEPATH "the path to ftheader.h" FORCE)
139     endif()
140   endif()
141
142   if (BUILD_SHARED_LIBS)
143     if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
144       if (FREETYPE_LIBRARY AND EXISTS "${FREETYPE_LIBRARY}")
145         set (3RDPARTY_FREETYPE_LIBRARY  "${FREETYPE_LIBRARY}" CACHE FILEPATH "The path to freetype library" FORCE)
146       endif()
147     endif()
148
149     if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
150       get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
151       set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
152     else()
153       set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
154     endif()
155   endif()
156 endif()
157
158 # the SECOND step in search for freetype library and header folders (additional search algorithms)
159
160 # ft2build.h
161 if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
162   set (FT2BUILD_NAMES ft2build.h config/ft2build.h freetype/config/ft2build.h)
163
164   # set 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build
165   set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build-NOTFOUND" CACHE FILEPATH "the path to ft2build.h" FORCE)
166
167   # cmake (version < 3.0) doesn't find ft2build.h of freetype (version is >= 2.5.1)
168   # do search taking into account freetype structure of 2.5.1 version
169   if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
170     find_path (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build NAMES ${FT2BUILD_NAMES}
171                                                       PATHS ${3RDPARTY_FREETYPE_DIR}
172                                                       PATH_SUFFIXES include freetype2 include/freetype2
173                                                       CMAKE_FIND_ROOT_PATH_BOTH
174                                                       NO_DEFAULT_PATH)
175   else()
176     find_path (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build NAMES ${FT2BUILD_NAMES}
177                                                       PATHS /usr/X11R6 /usr/local/X11R6 /usr/local/X11 /usr/freeware
178                                                       PATH_SUFFIXES include/freetype2 include freetype2
179                                                       CMAKE_FIND_ROOT_PATH_BOTH)
180   endif()
181 endif()
182
183 if (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build AND EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
184   list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build}")
185 else()
186   list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build)
187
188   set (3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build "" CACHE FILEPATH "the path to ft2build.h" FORCE)
189 endif()
190
191 # ftheader.h
192 if (NOT 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 OR NOT EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
193   set (FTHEADER_NAMES ftheader.h config/ftheader.h freetype/config/ftheader.h)
194
195   # set 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2
196   set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2-NOTFOUND" CACHE FILEPATH "the path to ftheader.h" FORCE)
197
198   if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
199     find_path (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 NAMES ${FTHEADER_NAMES}
200                                                        HINTS ${3RDPARTY_FREETYPE_DIR}
201                                                        PATH_SUFFIXES include/freetype2 include freetype2
202                                                        CMAKE_FIND_ROOT_PATH_BOTH
203                                                        NO_DEFAULT_PATH)
204   else()
205     find_path (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 NAMES ${FTHEADER_NAMES}
206                                                        PATHS /usr/X11R6 /usr/local/X11R6 /usr/local/X11 /usr/freeware
207                                                        PATH_SUFFIXES include/freetype2 include freetype2
208                                                        CMAKE_FIND_ROOT_PATH_BOTH)
209   endif()
210 endif()
211
212 if (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
213   list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2}")
214 else()
215   list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2)
216
217   set (3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2 "" CACHE FILEPATH "the path to ftheader.h" FORCE)
218 endif()
219
220 # freetype library
221 #if (BUILD_SHARED_LIBS)
222   if (NOT 3RDPARTY_FREETYPE_LIBRARY OR NOT EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
223     set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
224
225     set (FREETYPE_PATH_SUFFIXES lib)
226     if (ANDROID)
227       set (FREETYPE_PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES} libs/${ANDROID_ABI})
228     endif()
229
230     # set 3RDPARTY_FREETYPE_LIBRARY as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_LIBRARY
231     set (3RDPARTY_FREETYPE_LIBRARY "3RDPARTY_FREETYPE_LIBRARY-NOTFOUND" CACHE FILEPATH "The path to freetype library" FORCE)
232
233     if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
234       find_library (3RDPARTY_FREETYPE_LIBRARY ${CSF_FREETYPE}
235                                               PATHS "${3RDPARTY_FREETYPE_LIBRARY_DIR}" "${3RDPARTY_FREETYPE_DIR}"
236                                               PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
237                                               CMAKE_FIND_ROOT_PATH_BOTH
238                                               NO_DEFAULT_PATH)
239     else()
240       find_library (3RDPARTY_FREETYPE_LIBRARY ${CSF_FREETYPE}
241                                               PATH_SUFFIXES ${FREETYPE_PATH_SUFFIXES}
242                                               CMAKE_FIND_ROOT_PATH_BOTH)
243     endif()
244
245     if (3RDPARTY_FREETYPE_LIBRARY AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY}")
246       get_filename_component (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY}" PATH)
247       set (3RDPARTY_FREETYPE_LIBRARY_DIR "${3RDPARTY_FREETYPE_LIBRARY_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
248     else()
249       set (3RDPARTY_FREETYPE_LIBRARY_DIR "" CACHE PATH "The directory containing freetype library" FORCE)
250     endif()
251   endif()
252
253   if (3RDPARTY_FREETYPE_LIBRARY_DIR AND EXISTS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
254     list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_FREETYPE_LIBRARY_DIR}")
255   else()
256     list (APPEND 3RDPARTY_NO_LIBS 3RDPARTY_FREETYPE_LIBRARY_DIR)
257
258     set (3RDPARTY_FREETYPE_LIBRARY "" CACHE FILEPATH "The path to freetype library" FORCE)
259   endif()
260
261   # freetype shared library
262   if (WIN32)
263     if (NOT 3RDPARTY_FREETYPE_DLL OR NOT EXISTS "${3RDPARTY_FREETYPE_DLL}")
264
265       set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
266
267       # set 3RDPARTY_FREETYPE_DLL as notfound, otherwise find_library can't assign a new value to 3RDPARTY_FREETYPE_DLL
268       set (3RDPARTY_FREETYPE_DLL "3RDPARTY_FREETYPE_DLL-NOTFOUND" CACHE FILEPATH "The path to freetype shared library" FORCE)
269
270       if (3RDPARTY_FREETYPE_DIR AND EXISTS "${3RDPARTY_FREETYPE_DIR}")
271         find_library (3RDPARTY_FREETYPE_DLL ${CSF_FREETYPE}
272                                             PATHS "${3RDPARTY_FREETYPE_DIR}"
273                                             PATH_SUFFIXES bin
274                                             NO_DEFAULT_PATH)
275       else()
276         find_library (3RDPARTY_FREETYPE_DLL ${CSF_FREETYPE}
277                                             PATH_SUFFIXES bin)
278       endif()
279
280       if (3RDPARTY_FREETYPE_DLL AND EXISTS "${3RDPARTY_FREETYPE_DLL}")
281         get_filename_component (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL}" PATH)
282         set (3RDPARTY_FREETYPE_DLL_DIR "${3RDPARTY_FREETYPE_DLL_DIR}" CACHE PATH "The directory containing freetype library" FORCE)
283       else()
284         set (3RDPARTY_FREETYPE_DLL_DIR "" CACHE PATH "The directory containing freetype shared library" FORCE)
285
286         set (3RDPARTY_FREETYPE_DLL "" CACHE FILEPATH "freetype shared library" FORCE)
287       endif()
288     endif()
289
290     if (3RDPARTY_FREETYPE_DLL_DIR OR EXISTS "${3RDPARTY_FREETYPE_DLL_DIR}")
291       list (APPEND 3RDPARTY_DLL_DIRS "${3RDPARTY_FREETYPE_DLL_DIR}")
292     else()
293       list (APPEND 3RDPARTY_NO_DLLS 3RDPARTY_FREETYPE_DLL_DIR)
294     endif()
295   endif()
296
297   # install instructions
298   if (INSTALL_FREETYPE)
299     OCCT_MAKE_OS_WITH_BITNESS()
300
301     if (WIN32)
302       if (SINGLE_GENERATOR)
303         install (FILES "${3RDPARTY_FREETYPE_DLL}" DESTINATION "${INSTALL_DIR_BIN}")
304       else()
305         install (FILES "${3RDPARTY_FREETYPE_DLL}"
306                  CONFIGURATIONS Release
307                  DESTINATION "${INSTALL_DIR_BIN}")
308         install (FILES "${3RDPARTY_FREETYPE_DLL}"
309                  CONFIGURATIONS RelWithDebInfo
310                  DESTINATION "${INSTALL_DIR_BIN}i")
311         install (FILES "${3RDPARTY_FREETYPE_DLL}"
312                  CONFIGURATIONS Debug
313                  DESTINATION "${INSTALL_DIR_BIN}d")
314       endif()
315     else()
316       get_filename_component(3RDPARTY_FREETYPE_LIBRARY_ABS ${3RDPARTY_FREETYPE_LIBRARY} REALPATH)
317       get_filename_component(3RDPARTY_FREETYPE_LIBRARY_NAME ${3RDPARTY_FREETYPE_LIBRARY} NAME)
318
319       if (SINGLE_GENERATOR)
320         install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
321                  DESTINATION "${INSTALL_DIR_LIB}"
322                  RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
323       else()
324         install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
325                  CONFIGURATIONS Release
326                  DESTINATION "${INSTALL_DIR_LIB}"
327                  RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
328         install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
329                  CONFIGURATIONS RelWithDebInfo
330                  DESTINATION "${INSTALL_DIR_LIB}i"
331                  RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
332         install (FILES "${3RDPARTY_FREETYPE_LIBRARY_ABS}"
333                  CONFIGURATIONS Debug
334                  DESTINATION "${INSTALL_DIR_LIB}d"
335                  RENAME ${3RDPARTY_FREETYPE_LIBRARY_NAME}.6)
336       endif()
337     endif()
338
339     set (USED_3RDPARTY_FREETYPE_DIR "")
340   else()
341     # the library directory for using by the executable
342     if (WIN32)
343       set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_DLL_DIR})
344     else()
345       set (USED_3RDPARTY_FREETYPE_DIR ${3RDPARTY_FREETYPE_LIBRARY_DIR})
346     endif()
347   endif()
348 #endif()
349
350 # unset all redundant variables
351 OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_ft2build)
352 OCCT_CHECK_AND_UNSET(FREETYPE_INCLUDE_DIR_freetype2)
353 OCCT_CHECK_AND_UNSET(FREETYPE_LIBRARY)
354
355 if (BUILD_SHARED_LIBS)
356   mark_as_advanced (3RDPARTY_FREETYPE_LIBRARY 3RDPARTY_FREETYPE_DLL)
357 else()
358   OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL)
359   OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_DLL_DIR)
360   OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY)
361   OCCT_CHECK_AND_UNSET(3RDPARTY_FREETYPE_LIBRARY_DIR)
362   OCCT_CHECK_AND_UNSET(INSTALL_FREETYPE)
363 endif()