summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorStefan Wildemann <metalstrolch@users.noreply.github.com>2017-04-24 11:19:49 +0200
committerGitHub <noreply@github.com>2017-04-24 11:19:49 +0200
commitf221cd197fc8ef915b76c3b7b170ccd76178ad74 (patch)
tree90782890a6d126983d22244e473eb7c3cca9420c /CMakeLists.txt
parentc25b3e102955e12ff1409c0a85a15f848e2d8225 (diff)
downloadnavit-f221cd197fc8ef915b76c3b7b170ccd76178ad74.tar.gz
Fix: Allow unusual building (#215)R7404
* Support unusual building This patch updates navits cmake system to allow more unusual build and install path configurations as well as renaming the navit binary. This sis required for restricted environments like Sailfish OS harbour that do not follow usual path conventions. You can now: redefine the binary name (NAVIT_BINARY) control the translation file names (PACKAGE) select the library directory (LIB_DIR) select the share directory (SHARE_DIR) select the locales directory (LOCALE_DIR) select the images directory (IMAGE_DIR) select the man directory (MAN_DIR) the .desktop file is updated and the man file is renamed according to this and the install prefix is still honoured.
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-xCMakeLists.txt29
1 files changed, 18 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe9457e23..310639de1 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ set(NAVIT_VERSION_PATCH "1")
set(PACKAGE_VERSION "${NAVIT_VERSION_MAJOR}.${NAVIT_VERSION_MINOR}.${NAVIT_VERSION_PATCH}")
set(PACKAGE_NAME "navit-git")
-set(PACKAGE "navit")
+set(PACKAGE "navit" CACHE STRING "Navit package name")
set(PACKAGE_STRING "${PACKAGE} ${PACKAGE_VERSION}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
@@ -28,12 +28,19 @@ 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)
+# binary name
+set(NAVIT_BINARY navit CACHE STRING "Navit binary name")
# install path
-set(BIN_DIR bin)
-set(SHARE_DIR share/navit)
-set(LOCALE_DIR share/locale)
-set(IMAGE_DIR share/navit/xpm)
-set(MAN_DIR share/man/man1)
+set(BIN_DIR bin CACHE PATH "Navit bin path")
+add_definitions ("-DBIN_DIR=\"${BIN_DIR}\"")
+set(SHARE_DIR share/navit CACHE PATH "Navit share path")
+add_definitions ("-DSHARE_DIR=\"${SHARE_DIR}\"")
+set(LOCALE_DIR share/locale CACHE PATH "Navit locale path")
+add_definitions ("-DLOCALE_DIR=\"${LOCALE_DIR}\"")
+set(IMAGE_DIR share/navit/xpm CACHE PATH "Navit image path")
+add_definitions ("-DIMAGE_DIR=\"${IMAGE_DIR}\"")
+set(MAN_DIR share/man/man1 CACHE PATH "Navit man path")
+add_definitions ("-DMAN_DIR=\"${MAN_DIR}\"")
# LIB_DIR
IF(UNIX AND NOT ANDROID AND NOT APPLE)
IF (NOT LIBDIR)
@@ -41,10 +48,10 @@ IF(UNIX AND NOT ANDROID AND NOT APPLE)
MESSAGE(STATUS "You can set it manually with -DLIBDIR=<value>")
# check 64 bit
IF (CMAKE_SIZEOF_VOID_P EQUAL 4)
- SET(LIB_DIR lib)
+ SET(LIB_DIR lib/navit CACHE PATH "Navit 32bit bin path")
MESSAGE(STATUS " LIB_DIR (highest subdirectory if LIBDIR) is set to '${LIB_DIR}'")
ELSE (CMAKE_SIZEOF_VOID_P EQUAL 4)
- SET(LIB_DIR lib64)
+ SET(LIB_DIR lib64/navit CACHE PATH "Navit 64bit bin path")
MESSAGE(STATUS " LIB_DIR (highest subdirectory if LIBDIR) is set to '${LIB_DIR}'")
ENDIF (CMAKE_SIZEOF_VOID_P EQUAL 4)
ELSE (NOT LIBDIR)
@@ -52,12 +59,12 @@ IF(UNIX AND NOT ANDROID AND NOT APPLE)
MESSAGE(STATUS " LIB_DIR (highest subdirectory if LIBDIR) is set to '${LIB_DIR}'")
ENDIF (NOT LIBDIR)
ELSE (UNIX AND NOT ANDROID AND NOT APPLE)
- SET(LIB_DIR lib)
+ SET(LIB_DIR lib/navit CACHE PATH "Navit unix bin path")
ENDIF (UNIX AND NOT ANDROID AND NOT APPLE)
-
foreach(EXTRA_MODULE ${EXTRA_MODULES})
add_module(${EXTRA_MODULE} "extra module specified" TRUE)
endforeach()
+add_definitions ("-DLIB_DIR=\"${LIB_DIR}\"")
if (EXTRA_LIBS)
list(APPEND NAVIT_LIBS ${EXTRA_LIBS})
@@ -634,7 +641,7 @@ if(CMAKE_SIZEOF_VOID_P LESS 8)
set_with_reason(BUILD_MAPTOOL "maptool works only on 64 bit architectures" FALSE)
endif()
-set(LOCALEDIR "${LOCALE_DIR}/locale")
+set(LOCALEDIR "${LOCALE_DIR}")
find_program(BZCAT NAMES bzcat)
if (SAMPLE_MAP)