From e67598eeb523d2a18d4e8e34cb491ad7c14b932a Mon Sep 17 00:00:00 2001 From: dhewg Date: Tue, 3 Jul 2012 18:13:52 +0200 Subject: [PATCH] Introduce CMAKE_INSTALL_PREFIX relative paths configure style install dirs. --- CMakeLists.txt | 17 +++++++++++++++++ config.h.in | 3 +++ 2 files changed, 20 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2cab6e..cfa86eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,6 +223,23 @@ if (WIN32) ) endif() +if (APPLE) + SET(bindir "${CMAKE_INSTALL_PREFIX}") + SET(libdir "${CMAKE_INSTALL_PREFIX}") + SET(datarootdir "${CMAKE_INSTALL_PREFIX}") + SET(datadir "${datarootdir}") +elseif (WIN32) + SET(bindir "${CMAKE_INSTALL_PREFIX}") + SET(libdir "${CMAKE_INSTALL_PREFIX}/lib") + SET(datarootdir "${CMAKE_INSTALL_PREFIX}") + SET(datadir "${datarootdir}") +else() + SET(bindir "${CMAKE_INSTALL_PREFIX}/bin") + SET(libdir "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/dhewm3") + SET(datarootdir "${CMAKE_INSTALL_PREFIX}/share") + SET(datadir "${datarootdir}/dhewm3") +endif() + configure_file( "${CMAKE_SOURCE_DIR}/config.h.in" "${CMAKE_BINARY_DIR}/config.h" diff --git a/config.h.in b/config.h.in index 9c0c951..b96976b 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,9 @@ #define BUILD_LIBRARY_SUFFIX "@CMAKE_SHARED_LIBRARY_SUFFIX@" +#define BUILD_LIBDIR "@libdir@" +#define BUILD_DATADIR "@datadir@" + #cmakedefine HAVE_JPEG_MEM_SRC #cmakedefine ID_ENABLE_CURL