comparison CMakeLists.txt @ 2:c24af3462002

initial commit
author Eris Caffee <discordia@eldalin.com>
date Sat, 27 Apr 2013 13:22:17 -0500
parents 9c54994a2635
children 4f8b47ac2715 7ae4ee5c27f8
comparison
equal deleted inserted replaced
1:fc7baf530be1 2:d50a1986ce7c
64 64
65 cmake_minimum_required (VERSION 2.6 FATAL_ERROR) 65 cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
66 #set (CMAKE_VERBOSE_MAKEFILE ON) 66 #set (CMAKE_VERBOSE_MAKEFILE ON)
67 67
68 # Name your program! 68 # Name your program!
69 set (App_Name "") 69 set (App_Name "solar-system")
70 if (App_Name STREQUAL "") 70 if (App_Name STREQUAL "")
71 message (FATAL_ERROR "You must set the App_Name variable!") 71 message (FATAL_ERROR "You must set the App_Name variable!")
72 endif () 72 endif ()
73 73
74 # Every project must have a name. 74 # Every project must have a name.
110 endif () 110 endif ()
111 111
112 112
113 ################################################################################ 113 ################################################################################
114 # When using GCC turn on lots of warnings. 114 # When using GCC turn on lots of warnings.
115 # Some other options to consider: 115 # Some other options to consider:
116 # C++ -Weffc++ 116 # C++ -Weffc++ -std=c++0x
117 # C -std=gnu99 -std=c99 117 # C -std=gnu99 -std=c99
118 118
119 if (CMAKE_COMPILER_IS_GNUCXX) 119 if (CMAKE_COMPILER_IS_GNUCXX)
120 add_definitions(-pedantic -Wall) 120 add_definitions(-pedantic -Wall -std=c++0x)
121 endif () 121 endif ()
122 122
123 123
124 ################################################################################ 124 ################################################################################
125 125
131 131
132 132
133 ################################################################################ 133 ################################################################################
134 # The core project files 134 # The core project files
135 135
136 file (GLOB SRCS src/*.c src/*.cpp) 136 file (GLOB SRCS src/*.c src/*.cpp
137 file (GLOB HDRS include/*.h include/*.hpp) 137 /home/eris/gamedev/study/OpenGL_Superbible/work/Src/GLTools/src/*
138 )
139 file (GLOB HDRS include/*.h include/*.hpp
140 /home/eris/gamedev/study/OpenGL_Superbible/work/Src/GLTools/include/*
141 /home/eris/gamedev/study/OpenGL_Superbible/work/Src/GLTools/include/GL/*
142
143 )
138 144
139 # The directories that contain the libraries we will be linking against. 145 # The directories that contain the libraries we will be linking against.
140 # This must come before the ADD_EXECUTABLE directive. 146 # This must come before the ADD_EXECUTABLE directive.
141 link_directories ( 147 link_directories (
142 ) 148 )
143 149
144 # The directories that contain the include files our programs use. 150 # The directories that contain the include files our programs use.
145 # This must come before the ADD_EXECUTABLE directive. 151 # This must come before the ADD_EXECUTABLE directive.
146 include_directories ( 152 include_directories (
147 ${CMAKE_SOURCE_DIR}/include 153 ${CMAKE_SOURCE_DIR}/include
154 /home/eris/gamedev/study/OpenGL_Superbible/work/Src/GLTools/include/
155 /home/eris/gamedev/study/OpenGL_Superbible/work/Src/GLTools/include/GL
148 ) 156 )
149 157
150 # Define the executable program file we are creating. We must list all of 158 # Define the executable program file we are creating. We must list all of
151 # the source files. 159 # the source files.
152 if (WIN32) 160 if (WIN32)
153 add_executable (${App_Name} WIN32 161 add_executable (${App_Name} WIN32
154 ${SRCS} 162 ${SRCS}
155 ${HDRS} 163 ${HDRS}
156 ) 164 )
157 else () 165 else ()
166 # I should NOT have to define this symbol explictly. Why do I?
167 add_definitions(-Dlinux)
168
158 add_executable (${App_Name} 169 add_executable (${App_Name}
159 ${SRCS} 170 ${SRCS}
160 ${HDRS} 171 ${HDRS}
161 ) 172 )
162 endif () 173 endif ()
398 endif (Option_SDL_Dev) 409 endif (Option_SDL_Dev)
399 410
400 411
401 ################################################################################ 412 ################################################################################
402 413
403 option(Option_OpenGL_Dev "Build an OpenGL Application." OFF) 414 option(Option_OpenGL_Dev "Build an OpenGL Application." ON)
404 415
405 if (Option_OpenGL_Dev) 416 if (Option_OpenGL_Dev)
406 417
407 find_package(OpenGL) 418 find_package(OpenGL)
408 if (NOT OPEN_FOUND) 419 if (NOT OPENGL_FOUND)
409 message (FATAL_ERROR "OpenGL not found!") 420 message (FATAL_ERROR "OpenGL not found!")
410 endif (NOT OPEN_FOUND) 421 endif (NOT OPENGL_FOUND)
411 422
412 include_directories( 423 include_directories(
413 ${OPENGL_INCLUDE_DIR} 424 ${OPENGL_INCLUDE_DIR}
414 ${INCLUDE_DIRECTORIES} 425 ${INCLUDE_DIRECTORIES}
415 ) 426 )
416 427
417 target_link_libraries(${App_Name} 428 target_link_libraries(${App_Name}
418 ${OPENGL_LIBRARIES} 429 ${OPENGL_LIBRARIES}
419 ${TARGET_LINK_LIBRARIES} 430 ${TARGET_LINK_LIBRARIES}
420 ) 431 )
432
433 option(Option_GLUT_Dev "Build a GLUT Application." ON)
434
435 if (Option_GLUT_Dev)
436
437 find_package(GLUT)
438 if (NOT GLUT_FOUND)
439 message (FATAL_ERROR "GLUT not found!")
440 endif()
441
442 include_directories(
443 ${GLUT_INCLUDE_DIR}
444 ${INCLUDE_DIRECTORIES}
445 )
446
447 target_link_libraries(${App_Name}
448 ${GLUT_LIBRARIES}
449 ${TARGET_LINK_LIBRARIES}
450 )
451
452 endif()
421 453
422 endif () 454 endif ()
423 455
424 ################################################################################ 456 ################################################################################
425 457
443 ) 475 )
444 476
445 endif () 477 endif ()
446 478
447 ################################################################################ 479 ################################################################################
480