From afe355e9b94af7739ef8d2edc2a52baafb7cb3b3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 2 Mar 2014 12:20:49 -0800 Subject: [PATCH] begin creating a make install target. add a script to set up PATHs for cmake --- s/cmake-init | 28 ++++++++++++++++++++++++++++ src/CMakeLists.txt | 2 ++ 2 files changed, 30 insertions(+) create mode 100755 s/cmake-init diff --git a/s/cmake-init b/s/cmake-init new file mode 100755 index 000000000..1b2e9526b --- /dev/null +++ b/s/cmake-init @@ -0,0 +1,28 @@ +#!/bin/sh +if [ ! -e ../CMakeLists.txt ]; then + echo "are you sure you are in the build directory?" + exit +fi + +MACHINE=$(gcc -dumpmachine) +rm -f CMakeCache.txt + +# use anything installed in /opt or /usr +LIBRARY_PATH=/opt/lib:/opt/lib/$MACHINE:/usr/lib/$MACHINE +INCLUDE_PATH=/opt/include:/usr/include +PREFIX_PATH=/opt + +# I like to put stuff in ~/usr if I don't have permission to install packages on the machine: +if [ -d $HOME/usr ]; then + LIBRARY_PATH=$HOME/usr/lib:$HOME/usr/lib/$MACHINE:$LIBRARY_PATH + INCLUDE_PATH=$HOME/usr/include:$HOME/usr/include/$MACHINE:$INCLUDE_PATH + PREFIX_PATH=$HOME/usr:$HOME/usr/local:$PREFIX_PATH +fi + +cmake .. \ + -DCMAKE_MODULE_PATH=$PWD/../cmake/Modules \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_LIBRARY_PATH=$LIBRARY_PATH \ + -DCMAKE_INCLUDE_PATH=$INCLUDE_PATH \ + -DCMAKE_PREFIX_PATH=$PREFIX_PATH \ + -DCMAKE_INSTALL_PREFIX=$HOME/eressea $* diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b2e7fec7..006fe43c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -153,3 +153,5 @@ target_link_libraries(test_eressea add_test(server test_eressea) add_test(NAME E3 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/game-e3 COMMAND $ -e run_tests) add_test(NAME E2 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/game-e2 COMMAND $ -e run_tests) + +install(TARGETS eressea DESTINATION bin)