CMakeLists.txt
author Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Tue, 11 May 2010 21:21:26 -0500
branchcmake
changeset 108 5c75adc4301e
parent 106 e9183cfb697e
child 112 51b12649d519
permissions -rw-r--r--
Added support for 'make install' target in CMake scripts
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
103
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
     1
project(lugaru)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
     2
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
     3
cmake_minimum_required(VERSION 2.6)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
     4
108
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
     5
if(NOT CMAKE_BUILD_TYPE)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
     6
  set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
     7
      "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel"
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
     8
      FORCE)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
     9
endif(NOT CMAKE_BUILD_TYPE)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    10
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    11
if(NOT LUGARU_INSTALL_PREFIX)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    12
  if(WIN32)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    13
     set(LUGARU_INSTALL_PREFIX C:\Lugaru CACHE PATH
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    14
     "LUGARU_INSTALL_PREFIX: Install path prefix, prepended onto install directories."
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    15
      FORCE)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    16
  else(WIN32)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    17
     set(LUGARU_INSTALL_PREFIX /usr/local/lugaru CACHE PATH
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    18
     "CMAKE_INSTALL_PREFIX: Install path prefix, prepended onto install directories."
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    19
      FORCE)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    20
  endif(WIN32)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    21
endif(NOT LUGARU_INSTALL_PREFIX)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    22
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    23
set(CMAKE_INSTALL_PREFIX "${LUGARU_INSTALL_PREFIX}" CACHE INTERNAL "Prefix
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    24
prepended to install directories" FORCE)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    25
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    26
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    27
106
e9183cfb697e Added in support for the CMake module for searching for and configuring to use libvorbisfile and libogg
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 103
diff changeset
    28
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
103
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    29
find_package(OpenAL REQUIRED)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    30
find_package(BZip2 REQUIRED)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    31
find_package(PNG REQUIRED)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    32
find_package(JPEG REQUIRED)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    33
find_package(ZLIB REQUIRED)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    34
find_package(OpenGL REQUIRED)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    35
find_package(GLU REQUIRED)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    36
find_package(SDL REQUIRED)
106
e9183cfb697e Added in support for the CMake module for searching for and configuring to use libvorbisfile and libogg
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 103
diff changeset
    37
find_package(OggVorbis REQUIRED)
103
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    38
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    39
include_directories(
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    40
	${OPENAL_INCLUDES}
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    41
	${BZIP2_INCLUDE_DIR}
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    42
	${JPEG_INCLUDE_DIR}
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    43
	${PNG_INCLUDE_DIR}
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    44
	${ZLIB_INCLUDE_DIR}
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    45
	${OPENGL_INCLUDE_DIR}
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    46
	${GLU_INCLUDE_DIR}
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    47
	${SDL_INCLUDE_DIR}
106
e9183cfb697e Added in support for the CMake module for searching for and configuring to use libvorbisfile and libogg
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 103
diff changeset
    48
	${VORBISFILE_INCLUDE_DIR}
e9183cfb697e Added in support for the CMake module for searching for and configuring to use libvorbisfile and libogg
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 103
diff changeset
    49
	${OGG_INCLUDE_DIR}
103
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    50
	${CMAKE_SOURCE_DIR}/Source)
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    51
106
e9183cfb697e Added in support for the CMake module for searching for and configuring to use libvorbisfile and libogg
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 103
diff changeset
    52
set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIBRARY} ${GLU_LIBRARY} ${OPENGL_LIBRARY} ${VORBISFILE_LIBS} ${OGG_LIBS})
103
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    53
e58c73e8c0f1 Quickly created CMake to build the source
Harley Laue <losinggeneration@gmail.com>
parents:
diff changeset
    54
add_subdirectory(Source)
108
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    55
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    56
# Install target
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    57
if(WIN32)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    58
	install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru.exe DESTINATION ${CMAKE_INSTALL_PREFIX})
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    59
else(WIN32)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    60
	install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru DESTINATION ${CMAKE_INSTALL_PREFIX})
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    61
endif(WIN32)
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    62
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    63
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${CMAKE_INSTALL_PREFIX})
5c75adc4301e Added support for 'make install' target in CMake scripts
Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
parents: 106
diff changeset
    64