From 98190abd2007896b2eb9fad0630d99a9603c9226 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Tue, 11 May 2010 21:21:26 -0500 Subject: [PATCH] Added support for 'make install' target in CMake scripts --- CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca13013..0ea8c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,29 @@ project(lugaru) cmake_minimum_required(VERSION 2.6) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel" + FORCE) +endif(NOT CMAKE_BUILD_TYPE) + +if(NOT LUGARU_INSTALL_PREFIX) + if(WIN32) + set(LUGARU_INSTALL_PREFIX C:\Lugaru CACHE PATH + "LUGARU_INSTALL_PREFIX: Install path prefix, prepended onto install directories." + FORCE) + else(WIN32) + set(LUGARU_INSTALL_PREFIX /usr/local/lugaru CACHE PATH + "CMAKE_INSTALL_PREFIX: Install path prefix, prepended onto install directories." + FORCE) + endif(WIN32) +endif(NOT LUGARU_INSTALL_PREFIX) + +set(CMAKE_INSTALL_PREFIX "${LUGARU_INSTALL_PREFIX}" CACHE INTERNAL "Prefix +prepended to install directories" FORCE) + + + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") find_package(OpenAL REQUIRED) find_package(BZip2 REQUIRED) @@ -29,3 +52,13 @@ include_directories( set(LUGARU_LIBS ${OPENAL_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIBRARY} ${GLU_LIBRARY} ${OPENGL_LIBRARY} ${VORBISFILE_LIBS} ${OGG_LIBS}) add_subdirectory(Source) + +# Install target +if(WIN32) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru.exe DESTINATION ${CMAKE_INSTALL_PREFIX}) +else(WIN32) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/Source/lugaru DESTINATION ${CMAKE_INSTALL_PREFIX}) +endif(WIN32) + +install(DIRECTORY ${CMAKE_SOURCE_DIR}/Data DESTINATION ${CMAKE_INSTALL_PREFIX}) + -- 2.39.5