--- /dev/null
+PROJECT(freeglut)\r
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)\r
+\r
+SET(FREEGLUT_SRCS\r
+ src/freeglut_callbacks.c\r
+ src/freeglut_cursor.c\r
+ src/freeglut_display.c\r
+ src/freeglut_ext.c\r
+ src/freeglut_font.c\r
+ src/freeglut_font_data.c\r
+ src/freeglut_gamemode.c\r
+ src/freeglut_geometry.c\r
+ src/freeglut_glutfont_definitions.c\r
+ src/freeglut_init.c\r
+ src/freeglut_input_devices.c\r
+ src/freeglut_joystick.c\r
+ src/freeglut_main.c\r
+ src/freeglut_menu.c\r
+ src/freeglut_misc.c\r
+ src/freeglut_overlay.c\r
+ src/freeglut_spaceball.c\r
+ src/freeglut_state.c\r
+ src/freeglut_stroke_mono_roman.c\r
+ src/freeglut_stroke_roman.c\r
+ src/freeglut_structure.c\r
+ src/freeglut_teapot.c\r
+ src/freeglut_videoresize.c\r
+ src/freeglut_window.c\r
+ src/freeglut_xinput.c\r
+)\r
+\r
+IF(WIN32)\r
+ LIST(APPEND FREEGLUT_SRCS src/freeglut_windows.c)\r
+ELSE()\r
+ LIST(APPEND FREEGLUT_SRCS src/freeglut_x11.c)\r
+ENDIF()\r
+\r
+# Neatly organize all of the output files in the build directory\r
+SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)\r
+SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)\r
+\r
+# BUILD_SHARED_LIBS is already a standard CMake variable, but we need to\r
+# re-delcare it here so it will show up in the GUI.\r
+OPTION(BUILD_SHARED_LIBS "Build FreeGLUT as a shared library." ON)\r
+\r
+FIND_PACKAGE(OpenGL REQUIRED)\r
+\r
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${OPENGL_INCLUDE_DIR})\r
+\r
+IF(WIN32)\r
+ MESSAGE(WARNING "Insecure CRT warnings hidden (might want to fix these)")\r
+ ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)\r
+ENDIF()\r
+\r
+INCLUDE(CheckIncludeFiles)\r
+\r
+CHECK_INCLUDE_FILES(X11/extensions/xf86vmode.h HAVE_X11_EXTENSIONS_XF86VMODE_H)\r
+CHECK_INCLUDE_FILES(X11/extensions/Xrandr.h HAVE_X11_EXTENSIONS_XRANDR_H)\r
+CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)\r
+CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)\r
+CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)\r
+CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H)\r
+CHECK_INCLUDE_FILES(sys/param.h HAVE_SYS_PARAM_H)\r
+CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H)\r
+CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H)\r
+CHECK_INCLUDE_FILES(errno.h HAVE_ERRNO_H)\r
+CHECK_INCLUDE_FILES(usbhid.h HAVE_USBHID_H)\r
+\r
+# The generated config.h is placed in the project's build directory, just to\r
+# ensure that all CMake-generated files are kept away from the main source tree.\r
+# As a result, the build directory must to be added to the include path list.\r
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)\r
+INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})\r
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)\r
+\r
+IF(BUILD_SHARED_LIBS)\r
+ IF(WIN32)\r
+ LIST(APPEND FREEGLUT_SRCS src/freeglutdll.def freeglut.rc)\r
+ ENDIF()\r
+ ADD_DEFINITIONS(-DFREEGLUT_EXPORTS)\r
+ELSE()\r
+ ADD_DEFINITIONS(-DFREEGLUT_STATIC)\r
+ENDIF()\r
+\r
+# The default library type is determined by BUILD_SHARED_LIBS\r
+ADD_LIBRARY(freeglut ${FREEGLUT_SRCS})\r
+\r
+IF(NOT BUILD_SHARED_LIBS)\r
+ SET_TARGET_PROPERTIES(freeglut PROPERTIES OUTPUT_NAME freeglut_static)\r
+ENDIF()\r
+\r
+INSTALL(TARGETS freeglut DESTINATION lib)\r
+INSTALL(DIRECTORY "${CMAKE_SOURCE_DIR}/include/GL" DESTINATION include\r
+ FILES_MATCHING PATTERN "*.h")\r
+\r
+MACRO(ADD_DEMO name)\r
+ ADD_EXECUTABLE(${name} ${ARGN})\r
+ TARGET_LINK_LIBRARIES(${name} freeglut)\r
+ INSTALL(TARGETS ${name} DESTINATION bin)\r
+ENDMACRO()\r
+\r
+ADD_DEMO(CallbackMaker progs/demos/CallbackMaker/CallbackMaker.c)\r
+ADD_DEMO(Fractals progs/demos/Fractals/Fractals.c)\r
+ADD_DEMO(Fractals_random progs/demos/Fractals_random/Fractals_random.c)\r
+ADD_DEMO(Lorenz progs/demos/Lorenz/Lorenz.c)\r
+ADD_DEMO(One progs/demos/One/One.c)\r
+ADD_DEMO(Resizer progs/demos/Resizer/Resizer.c)\r
+ADD_DEMO(shapes progs/demos/shapes/shapes.c)\r
+ADD_DEMO(smooth_opengl3 progs/demos/smooth_opengl3/smooth_opengl3.c)\r
+ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c)\r
+ADD_DEMO(subwin progs/demos/subwin/subwin.c)\r
+\r
+\r