can now configure build such that runtime warnings and/or errors occuring in lib...
[freeglut] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
2 PROJECT(freeglut)
3
4 # NOTE: On Windows and Cygwin, the dll's are placed in the
5 # CMAKE_RUNTIME_OUTPUT_DIRECTORY, while their corresponding import
6 # libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY. On other
7 # platforms, such as Linux, the shared libraries are put in
8 # CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead.
9 # Static libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY on all
10 # platforms.
11 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
12 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
13 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
14
15 # setup version numbers
16 # TODO: Update these for each release!
17 set(VERSION_MAJOR 3)
18 set(VERSION_MINOR 0)
19 set(VERSION_PATCH 0)
20
21
22 # BUILD_SHARED_LIBS is already a standard CMake variable, but we need to
23 # re-declare it here so it will show up in the GUI.
24 # by default, we want to build both
25 OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
26 OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
27
28 # option for whether warnings and errors should be printed
29 OPTION(FREEGLUT_ERRORS "Lib prints errors to stderr" ON)
30 #MARK_AS_ADVANCED(FREEGLUT_ERRORS)
31 OPTION(FREEGLUT_WARNINGS "Lib prints warnings to stderr" ON)
32 #MARK_AS_ADVANCED(FREEGLUT_WARNINGS)
33
34 # option to also copy .pdb files to install directory when executing
35 # INSTALL target
36 IF(MSVC)
37     OPTION(INSTALL_PDB "Also install .pdb files" ON)
38 ELSE()
39     SET(INSTALL_PDB OFF)
40 ENDIF()
41
42 # OpenGL ES support
43 OPTION(FREEGLUT_GLES1 "Use OpenGL ES 1.x (requires EGL)" OFF)
44 OPTION(FREEGLUT_GLES2 "Use OpenGL ES 2.x (requires EGL) (overrides BUILD_GLES1)" OFF)
45
46
47
48 SET(FREEGLUT_HEADERS
49     include/GL/freeglut.h
50     include/GL/freeglut_ext.h
51     include/GL/freeglut_std.h
52     include/GL/glut.h
53 )
54 SET(FREEGLUT_SRCS
55     ${FREEGLUT_HEADERS}
56     src/fg_callbacks.c
57     src/fg_cursor.c
58     src/fg_display.c
59     src/fg_ext.c
60     src/fg_font_data.c
61     src/fg_gamemode.c
62     src/fg_gl2.c
63     src/fg_gl2.h
64     src/fg_init.c
65     src/fg_init.h
66     src/fg_internal.h
67     src/fg_input_devices.c
68     src/fg_joystick.c
69     src/fg_main.c
70     src/fg_main.h
71     src/fg_misc.c
72     src/fg_overlay.c
73     src/fg_spaceball.c
74     src/fg_state.c
75     src/fg_stroke_mono_roman.c
76     src/fg_stroke_roman.c
77     src/fg_structure.c
78     src/fg_videoresize.c
79     src/fg_window.c
80 )
81 # TODO: OpenGL ES requires a compatible version of these files:
82 IF(NOT FREEGLUT_GLES2 AND NOT FREEGLUT_GLES1)
83     LIST(APPEND FREEGLUT_SRCS
84         src/fg_font.c
85         src/fg_menu.c
86         src/fg_teapot.c
87         src/fg_teapot_data.h
88         src/fg_geometry.c
89     )
90 ELSE()
91     LIST(APPEND FREEGLUT_SRCS
92         src/fg_geometry.c
93         src/gles_stubs.c
94     )
95 ENDIF()
96
97 IF(WIN32)
98     LIST(APPEND FREEGLUT_SRCS
99         src/mswin/fg_cursor_mswin.c
100         src/mswin/fg_display_mswin.c
101         src/mswin/fg_ext_mswin.c
102         src/mswin/fg_gamemode_mswin.c
103         src/mswin/fg_init_mswin.c
104         src/mswin/fg_internal_mswin.h
105         src/mswin/fg_input_devices_mswin.c
106         src/mswin/fg_joystick_mswin.c
107         src/mswin/fg_main_mswin.c
108         src/mswin/fg_menu_mswin.c
109         src/mswin/fg_spaceball_mswin.c
110         src/mswin/fg_state_mswin.c
111         src/mswin/fg_structure_mswin.c
112         src/mswin/fg_window_mswin.c
113         ${CMAKE_BINARY_DIR}/freeglut.rc # generated below from freeglut.rc.in
114     )
115     IF (MSVC AND NOT CMAKE_CL_64)
116         # .def file only for 32bit Windows builds (TODO: MSVC only right
117         # now, needed for any other Windows platform?)
118         LIST(APPEND FREEGLUT_SRCS
119             ${CMAKE_BINARY_DIR}/freeglutdll.def # generated below from src/freeglutdll.def.in
120         )
121     ENDIF()
122
123 ELSEIF(ANDROID)
124     LIST(APPEND FREEGLUT_SRCS
125         src/android/native_app_glue/android_native_app_glue.c
126         src/android/native_app_glue/android_native_app_glue.h
127         src/android/fg_internal_android.h
128         src/android/fg_cursor_android.c
129         src/android/fg_ext_android.c
130         src/android/fg_gamemode_android.c
131         src/android/fg_init_android.c
132         src/android/fg_input_devices_android.c
133         src/android/fg_joystick_android.c
134         src/android/fg_main_android.c
135         src/android/fg_main_android.h
136         src/android/fg_runtime_android.c
137         src/android/fg_spaceball_android.c
138         src/android/fg_state_android.c
139         src/android/fg_structure_android.c
140         src/android/fg_window_android.c
141     )
142 ELSE()
143     LIST(APPEND FREEGLUT_SRCS
144         src/x11/fg_cursor_x11.c
145         src/x11/fg_ext_x11.c
146         src/x11/fg_gamemode_x11.c
147         src/x11/fg_glutfont_definitions_x11.c
148         src/x11/fg_init_x11.c
149         src/x11/fg_internal_x11.h
150         src/x11/fg_input_devices_x11.c
151         src/x11/fg_joystick_x11.c
152         src/x11/fg_main_x11.c
153         src/x11/fg_menu_x11.c
154         src/x11/fg_spaceball_x11.c
155         src/x11/fg_state_x11.c
156         src/x11/fg_structure_x11.c
157         src/x11/fg_window_x11.c
158         src/x11/fg_xinput_x11.c
159     )
160     IF(NOT(FREEGLUT_GLES2 OR FREEGLUT_GLES1))
161         LIST(APPEND FREEGLUT_SRCS
162             src/x11/fg_internal_x11_glx.h
163             src/x11/fg_display_x11_glx.c
164             src/x11/fg_state_x11_glx.c
165             src/x11/fg_state_x11_glx.h
166             src/x11/fg_window_x11_glx.c
167             src/x11/fg_window_x11_glx.h
168         )
169     ENDIF()
170 ENDIF()
171 IF(FREEGLUT_GLES2 OR FREEGLUT_GLES1)
172     LIST(APPEND FREEGLUT_SRCS
173         src/egl/fg_internal_egl.h
174         src/egl/fg_display_egl.c
175         src/egl/fg_ext_egl.c
176         src/egl/fg_init_egl.c
177         src/egl/fg_init_egl.h
178         src/egl/fg_state_egl.c
179         src/egl/fg_state_egl.h
180         src/egl/fg_structure_egl.c
181         src/egl/fg_structure_egl.h
182         src/egl/fg_window_egl.c
183         src/egl/fg_window_egl.h
184     )
185 ENDIF()
186
187 # For OpenGL ES (GLES):
188 # - compile with -DFREEGLUT_GLES1 and -DFREEGLUT_GLES2 to cleanly
189 #   bootstrap headers inclusion in freeglut_std.h; these constants
190 #   also need to be defined in client applications (e.g. through
191 #   pkg-config), but use GLES constants directly for all other needs
192 # - define GLES version-specific library
193 IF(FREEGLUT_GLES2)
194   ADD_DEFINITIONS(-DFREEGLUT_GLES2)
195   LIST(APPEND LIBS GLESv2 EGL)
196 ELSEIF(FREEGLUT_GLES1)
197   ADD_DEFINITIONS(-DFREEGLUT_GLES1)
198   LIST(APPEND LIBS GLESv1_CM EGL)
199 ELSE()
200   FIND_PACKAGE(OpenGL REQUIRED)
201   LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
202   INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
203 ENDIF()
204
205 # lib m for math, not needed on windows
206 IF (NOT WIN32)
207     # For compilation:
208     LIST(APPEND LIBS m)
209     # For CHECK_FUNCTION_EXISTS:
210     LIST(APPEND CMAKE_REQUIRED_LIBRARIES m)
211 ENDIF()
212
213 IF(WIN32)
214     # hide insecure CRT warnings, common practice
215     ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
216     IF(MSVC)
217         SET( CMAKE_DEBUG_POSTFIX "d" )
218     ENDIF(MSVC)
219     
220 ENDIF()
221
222 IF(CMAKE_COMPILER_IS_GNUCC)
223   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
224   IF(!ANDROID)
225     # not setting -ansi as EGL/KHR headers doesn't support it
226     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")
227   ENDIF()
228 ENDIF(CMAKE_COMPILER_IS_GNUCC)
229
230 INCLUDE(CheckIncludeFiles)
231 IF(UNIX AND NOT ANDROID)
232     FIND_PACKAGE(X11 REQUIRED)
233     LIST(APPEND LIBS ${X11_LIBRARIES})
234     IF(X11_Xrandr_FOUND)
235         SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
236         LIST(APPEND LIBS ${X11_Xrandr_LIB})
237     ENDIF()
238     IF(X11_xf86vmode_FOUND)
239         SET(HAVE_X11_EXTENSIONS_XF86VMODE_H TRUE)
240         # Work-around http://www.cmake.org/Bug/bug_view_page.php?bug_id=6976
241         IF(NOT "${X11_Xxf86vm_LIB}")
242             SET(X11_Xxf86vm_LIB "Xxf86vm")
243         ENDIF()
244         LIST(APPEND LIBS ${X11_Xxf86vm_LIB})
245     ENDIF()
246     IF(X11_Xinput_FOUND)
247         # Needed for multi-touch:
248         CHECK_INCLUDE_FILES("${X11_Xinput_INCLUDE_PATH}/X11/extensions/XInput2.h" HAVE_X11_EXTENSIONS_XINPUT2_H)
249         LIST(APPEND LIBS ${X11_Xinput_LIB})
250     ENDIF()
251 ENDIF()
252 IF(ANDROID)
253     # -landroid for ANativeWindow
254     # -llog for native Android logging
255     LIST(APPEND LIBS android log)
256 ENDIF()
257
258 INCLUDE(CheckFunctionExists)
259 INCLUDE(CheckTypeSize)
260 CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
261 CHECK_INCLUDE_FILES(unistd.h    HAVE_UNISTD_H)
262 CHECK_INCLUDE_FILES(sys/time.h  HAVE_SYS_TIME_H)
263 CHECK_INCLUDE_FILES(stdbool.h   HAVE_STDBOOL_H)
264 CHECK_INCLUDE_FILES(sys/param.h HAVE_SYS_PARAM_H)
265 CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H)
266 CHECK_INCLUDE_FILES(fcntl.h     HAVE_FCNTL_H)
267 CHECK_INCLUDE_FILES(errno.h     HAVE_ERRNO_H)
268 CHECK_INCLUDE_FILES(usbhid.h    HAVE_USBHID_H)
269 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
270 CHECK_FUNCTION_EXISTS(vfprintf  HAVE_VFPRINTF)
271 CHECK_FUNCTION_EXISTS(_doprnt   HAVE_DOPRNT)
272 CHECK_FUNCTION_EXISTS(XParseGeometry   HAVE_XPARSEGEOMETRY)
273 IF (NOT HAVE_XPARSEGEOMETRY)
274    LIST(APPEND FREEGLUT_SRCS
275         src/util/xparsegeometry_repl.c
276         src/util/xparsegeometry_repl.h)
277    SET(NEED_XPARSEGEOMETRY_IMPL TRUE)
278 ENDIF()
279 # decide on suitable type for internal time keeping, 64-bit if possible
280 CHECK_INCLUDE_FILES(stdint.h    HAVE_STDINT_H)
281 CHECK_INCLUDE_FILES(inttypes.h  HAVE_INTTYPES_H)
282 IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H))
283     IF (MSVC)
284         # Some old Microsoft VC releases don't support unsigned long
285         # long, but all we care about is support for unsigned __int64 on
286         # MSVC, so test for presence of that type
287         CHECK_TYPE_SIZE("unsigned __int64" U__INT64 BUILTIN_TYPES_ONLY)
288     ELSEIF()
289         CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY)
290     ENDIF()
291 ENDIF()
292
293 # The generated config.h is placed in the project's build directory, just to
294 # ensure that all CMake-generated files are kept away from the main source tree.
295 # As a result, the build directory must to be added to the include path list.
296 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
297 INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
298 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
299 IF(WIN32)
300     # we also have to generate freeglut.rc, which contains the version
301     # number
302     CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.rc.in ${CMAKE_BINARY_DIR}/freeglut.rc)
303     IF (MSVC AND NOT CMAKE_CL_64)
304         # .def file only for 32bit Windows builds with Visual Studio
305         CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/freeglutdll.def.in ${CMAKE_BINARY_DIR}/freeglutdll.def)
306     ENDIF()
307 ENDIF()
308
309 IF(BUILD_SHARED_LIBS)
310     ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
311 ENDIF()
312 IF(BUILD_STATIC_LIBS)
313     ADD_LIBRARY(freeglut_static STATIC ${FREEGLUT_SRCS})
314 ENDIF()
315
316
317 IF(WIN32)
318     LIST(APPEND LIBS winmm)
319     IF(BUILD_SHARED_LIBS)
320         SET_TARGET_PROPERTIES(freeglut PROPERTIES COMPILE_FLAGS -DFREEGLUT_EXPORTS)
321     ENDIF()
322     IF(BUILD_STATIC_LIBS)
323         SET_TARGET_PROPERTIES(freeglut_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
324         # need to set machine:x64 for linker, at least for VC10, and
325         # doesn't hurt for older compilers:
326         # http://public.kitware.com/Bug/view.php?id=11240#c22768
327         IF (CMAKE_CL_64)
328             SET_TARGET_PROPERTIES(freeglut_static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
329         ENDIF()
330     ENDIF()
331 ELSE()
332     # on UNIX we need to make sure:
333     # - all shared libraries must have a soname/version, see :
334     #   http://sourceware.org/autobook/autobook/autobook_91.html#SEC91
335     #   http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
336     #   Current: -version-info 12:0:9 -> 3.9.0
337     #   Note: most platforms now prefer the latter major.minor.revision form
338     #   (e.g. FreeBSD, cf. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8765),
339     #   or special-cased FreeGLUT long ago (e.g. .so.4 on OpenBSD), so
340     #   the lack of support for current:revision:age in CMake should
341     #   not be a problem.
342     # - the output library should be named glut so it'll be linkable with -lglut
343     # - the shared library should link to the dependency libraries so that the user
344     #   won't have to link them explicitly (they shouldn't have to know that we depend
345     #   on Xrandr or Xxf86vm)
346     IF(FREEGLUT_GLES2)
347       SET(LIBNAME freeglut-gles2)
348     ELSEIF(FREEGLUT_GLES1)
349       SET(LIBNAME freeglut-gles1)
350     ELSE()
351       SET(LIBNAME glut)
352     ENDIF()
353
354     SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME ${LIBNAME})
355     SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
356     IF(ANDROID)
357         # Not in CMake toolchain file, because the toolchain
358         # file is called several times and generally doesn't
359         # seem to be meant for modifying CFLAGS:
360         # '-mandroid' is not mandatory but doesn't hurt
361         # '-O0 -gstabs+' helps the currently buggy GDB port
362         # Too late to manipulate ENV: SET(ENV{CFLAGS} "$ENV{CFLAGS} -mandroid")
363         # Not using _INIT variables, they seem to be used internally only
364         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mandroid")
365         SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -gstabs+")
366     ENDIF()
367 ENDIF()
368 IF(BUILD_SHARED_LIBS)
369     TARGET_LINK_LIBRARIES(freeglut ${LIBS})
370 ENDIF()
371 IF(BUILD_STATIC_LIBS)
372     TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
373 ENDIF()
374
375 IF(BUILD_SHARED_LIBS)
376     INSTALL(TARGETS freeglut
377             RUNTIME DESTINATION bin
378             LIBRARY DESTINATION lib
379             ARCHIVE DESTINATION lib
380     )
381     IF(INSTALL_PDB)
382         INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/freeglut${CMAKE_DEBUG_POSTFIX}.pdb
383             DESTINATION bin
384                         CONFIGURATIONS Debug)
385     ENDIF()
386 ENDIF()
387 IF(BUILD_STATIC_LIBS)
388     INSTALL(TARGETS freeglut_static
389             RUNTIME DESTINATION bin
390             LIBRARY DESTINATION lib
391             ARCHIVE DESTINATION lib
392     )
393     IF(INSTALL_PDB)
394         INSTALL(FILES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/Debug/freeglut_static${CMAKE_DEBUG_POSTFIX}.pdb
395             DESTINATION lib
396                         CONFIGURATIONS Debug)
397     ENDIF()
398 ENDIF()
399 INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL)
400
401
402
403 # Optionally build demos, on by default.
404 option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON )
405
406 SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS})
407 # lib m for math, not needed on windows
408 IF (NOT WIN32)
409     LIST(APPEND DEMO_LIBS m)
410 ENDIF()
411
412 MACRO(ADD_DEMO name)
413     IF( FREEGLUT_BUILD_DEMOS )
414         IF(BUILD_SHARED_LIBS)
415             ADD_EXECUTABLE(${name} ${ARGN})
416             TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
417             IF(WIN32 AND MSVC)
418                 SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX d)
419             ENDIF()
420         ENDIF()
421         IF(BUILD_STATIC_LIBS)
422             ADD_EXECUTABLE(${name}_static ${ARGN})
423             TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
424             SET_TARGET_PROPERTIES(${name}_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
425             IF(WIN32 AND MSVC)
426                 SET_TARGET_PROPERTIES(${name}_static PROPERTIES DEBUG_POSTFIX d)
427             ENDIF()
428         ENDIF()
429     ENDIF()
430 ENDMACRO()
431
432 ADD_DEMO(CallbackMaker   progs/demos/CallbackMaker/CallbackMaker.c)
433 ADD_DEMO(Fractals        progs/demos/Fractals/fractals.c)
434 ADD_DEMO(Fractals_random progs/demos/Fractals_random/fractals_random.c)
435 ADD_DEMO(Lorenz          progs/demos/Lorenz/lorenz.c)
436 ADD_DEMO(One             progs/demos/One/one.c)
437 ADD_DEMO(Resizer         progs/demos/Resizer/Resizer.cpp)
438 ADD_DEMO(multi-touch     progs/demos/multi-touch/multi-touch.c)
439 ADD_DEMO(shapes          progs/demos/shapes/shapes.c
440                          progs/demos/shapes/glmatrix.h
441                          progs/demos/shapes/glmatrix.c)
442 ADD_DEMO(smooth_opengl3  progs/demos/smooth_opengl3/smooth_opengl3.c)
443 IF(UNIX)
444     ADD_DEMO(spaceball       progs/demos/spaceball/spaceball.c
445                              progs/demos/spaceball/vmath.c
446                              progs/demos/spaceball/vmath.h)
447 ENDIF()
448 ADD_DEMO(subwin          progs/demos/subwin/subwin.c)
449 ADD_DEMO(timer           progs/demos/timer/timer.c)
450
451
452
453 # pkg-config support, to install at $(libdir)/pkgconfig
454 # Define static build dependencies
455 IF(WIN32)
456   SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm")
457 ELSEIF(FREEGLUT_GLES2)
458   IF(ANDROID)
459     SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lEGL -lm")
460   ELSE()
461     SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL -lm")
462   ENDIF()
463 ELSEIF(FREEGLUT_GLES1)
464   IF(ANDROID)
465     SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv1_CM -lEGL -lm")
466   ELSE()
467     SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv1_CM -lEGL -lm")
468   ENDIF()
469 ELSE()
470   SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
471 ENDIF()
472 # Client applications need to define FreeGLUT GLES version to
473 # bootstrap headers inclusion in freeglut_std.h:
474 SET(PC_LIBNAME "glut")
475 SET(PC_FILENAME "freeglut.pc")
476 IF(FREEGLUT_GLES2)
477   SET(PC_CFLAGS "-DFREEGLUT_GLES2")
478   SET(PC_LIBNAME "freeglut-gles2")
479   SET(PC_FILENAME "freeglut-gles2.pc")
480 ELSEIF(FREEGLUT_GLES1)
481   SET(PC_CFLAGS "-DFREEGLUT_GLES1")
482   SET(PC_LIBNAME "freeglut-gles1")
483   SET(PC_FILENAME "freeglut-gles1.pc")
484 ENDIF()
485 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
486 INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig/ RENAME ${PC_FILENAME})
487 # TODO: change the library and .pc name when building for GLES,
488 # e.g. -lglut-GLES2