[c12540] Remove the PREFIX parameter from the CMake files and use the standard CMAKE_INSTALL_PREFIX parameter instead

This also fixes the behaviour with relative paths, until now, it
calculated the absolute path from the location of the top level
CMakeLists.txt instead of your current directory where you called cmake.

You need to re-run CMake and define CMAKE_INSTALL_PREFIX and remove
PREFIX! You can do so by either removing all files in your build directory
and start from scratch or run 'cmake -DPREFIX= -DCMAKE_INSTALL_PREFIX=<install_path> <path_to_source>'.
A check has been added to the CMake file to make sure that PREFIX is no
longer used.

(based on commit [12391] - d489531)

Signed-off-by: DasBlub <DasBlub@gmail.com>
This commit is contained in:
DasBlub 2013-03-03 18:43:21 +01:00 committed by Antz
parent 86210e27d1
commit 10598c0743
3 changed files with 30 additions and 17 deletions

23
.travis.yml Normal file
View file

@ -0,0 +1,23 @@
language: cpp
branches:
only:
- master
compiler:
- gcc
- clang
script:
- test -d _build || mkdir _build
- test -d _install || mkdir _install
- cd _build
- cmake -DCMAKE_INSTALL_PREFIX=../_install ..
- make -j4
notifications:
irc:
channels:
- "irc.rizon.net#cmangos"
on_success: never
on_failure: always

View file

@ -17,7 +17,7 @@
#
project(MaNGOS)
set(MANGOS_VERSION 0.17.0)
set(MANGOS_VERSION 0.17)
# CMake policies
cmake_minimum_required(VERSION 2.8)
@ -59,11 +59,11 @@ endif()
message(
"\nThis script builds the MaNGOS server.
Options that can be used in order to configure the process:
PREFIX: Path where the server should be installed to
CMAKE_INSTALL_PREFIX: Path where the server should be installed to
PCH: Use precompiled headers
DEBUG: Debug mode
To set an option simply type -D<OPTION>=<VALUE> after 'cmake <srcs>'.
For example: cmake .. -DDEBUG=1 -DPREFIX=/opt/mangos\n"
For example: cmake .. -DDEBUG=1 -DCMAKE_INSTALL_PREFIX=/opt/mangos\n"
) # TODO: PLATFORM: Sets the architecture for compile (X86,X64)
# Override configuration-types - we don't use anything else than debug and release
@ -119,19 +119,9 @@ endif()
# option(SQL "Copy SQL files" 0)
# option(TOOLS "Build tools" 0)
# Set up the install-prefix
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
get_filename_component(PREFIX_ABSOLUTE "../mangos-server" ABSOLUTE)
set(CMAKE_INSTALL_PREFIX ${PREFIX_ABSOLUTE} CACHE PATH "Install path prefix." FORCE)
endif()
# TODO: remove this in the future! it has only been added to make the switch easier for end users
if(PREFIX)
if(!WIN32)
string(REGEX REPLACE "^~" "$ENV{HOME}" PREFIX ${PREFIX})
endif()
get_filename_component(PREFIX_ABSOLUTE ${PREFIX} ABSOLUTE)
set(CMAKE_INSTALL_PREFIX ${PREFIX} CACHE PATH "Install path prefix." FORCE)
else()
set(PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Install path prefix.")
message(FATAL_ERROR "The parameter PREFIX has been removed. Please re-run CMake and use CMAKE_INSTALL_PREFIX instead to define your installation location!")
endif()
set(BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12539"
#define REVISION_NR "12540"
#endif // __REVISION_NR_H__