summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBignaux Ronan <ronan@aimao.org>2018-09-02 17:07:51 +0200
committerBignaux Ronan <ronan@aimao.org>2019-05-25 14:23:26 +0200
commit4e5b35a97ea2f2e15b9b5f361ebd3bb9094a4be1 (patch)
tree697b30e287d5335a20a1c57283745814bc77c429 /CMakeLists.txt
parentbbff86825991abb7408abf1691118b112c83bed2 (diff)
downloadnavit-4e5b35a97ea2f2e15b9b5f361ebd3bb9094a4be1.tar.gz
Refactoring:cmake:from 2.6 to 3.2
Diffstat (limited to 'CMakeLists.txt')
-rwxr-xr-xCMakeLists.txt95
1 files changed, 54 insertions, 41 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 950314e72..3e6d4c683 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
+cmake_minimum_required(VERSION 3.2)
+
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.navitproject.navit")
set(MACOSX_BUNDLE_BUNDLE_NAME "Navit")
message(STATUS "Building with CMake V${CMAKE_VERSION}")
@@ -11,7 +13,6 @@ if (NOT DISABLE_CXX)
enable_language(CXX OPTIONAL)
endif(NOT DISABLE_CXX)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
set(NAVIT_VERSION_MAJOR "0")
set(NAVIT_VERSION_MINOR "5")
set(NAVIT_VERSION_PATCH "3")
@@ -146,8 +147,55 @@ INCLUDE (CheckIncludeFiles)
INCLUDE (CheckLibraryExists)
INCLUDE (CheckFunctionExists)
INCLUDE (CheckSymbolExists)
-find_package(Glib)
-find_package(Gmodule)
+
+################################
+# pkg-config based detection #
+################################
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules ( GMODULE gmodule-2.0 )
+ if (GMODULE_FOUND)
+ set(HAVE_GMODULE 1)
+ include_directories(${GMODULE_INCLUDE_DIRS})
+ list(APPEND NAVIT_LIBS ${GMODULE_LIBRARIES})
+ endif(GMODULE_FOUND)
+
+ pkg_check_modules (GLIB2 glib-2.0>=2.10)
+ if (GLIB2_FOUND)
+ set(HAVE_GLIB 1)
+ include_directories(${GLIB2_INCLUDE_DIRS})
+ list(APPEND NAVIT_LIBS ${GLIB2_LIBRARIES})
+ else(GLIB2_FOUND)
+ set_with_reason(support/glib "Glib not found" TRUE ${INTL_LIBS})
+ endif(GLIB2_FOUND)
+
+ pkg_check_modules(FONTCONFIG "fontconfig >= 2.2.0")
+ pkg_check_modules(DBUS "dbus-1 >= 1.4")
+ pkg_check_modules(DBUSGLIB dbus-glib-1)
+ if(DBUSGLIB_FOUND)
+ include_directories(${DBUSGLIB_INCLUDE_DIRS})
+ set_with_reason(binding/dbus "dbus-glib-1 found" TRUE ${DBUSGLIB_LIBRARIES})
+ set_with_reason(speech/dbus "dbus-glib-1 found" TRUE ${DBUSGLIB_LIBRARIES})
+ set_with_reason(vehicle/gpsd_dbus "dbus-glib-1 found" TRUE ${DBUSGLIB_LIBRARIES})
+ endif()
+
+ pkg_check_modules(LIBLOCATION liblocation)
+ pkg_check_modules(LIBOSSO libosso)
+ # Accept even old versions of libgps, because N810 uses an old version (see #1179).
+ pkg_check_modules(LIBGPS libgps)
+ pkg_check_modules(LIBGPS19 libgps>=2.90)
+ # libgpsd<V3.1 is buggy if LC_ALL is set.
+ pkg_check_modules(LIBGPS_NEW libgps>=3.1)
+ pkg_check_modules(LIBGARMIN libgarmin)
+ pkg_check_modules(IMLIB2 imlib2)
+ if(IMLIB2_FOUND)
+ set(HAVE_IMLIB2 1)
+ endif(IMLIB2_FOUND)
+endif(PKG_CONFIG_FOUND)
+
+#find_package(Iconv)
+#find_package(Gmodule)
find_package(ZLIB)
find_package(Freetype)
#find_library(SDL2MAIN SDL2)
@@ -162,10 +210,9 @@ find_package(GLUT)
find_package(GTK2 2.6 COMPONENTS gtk)
find_package(Gettext)
find_package(PNG)
-find_package(DBusGLib)
find_package(PythonLibs)
find_package(Threads)
-libfind_pkg_check_modules(FONTCONFIG fontconfig)
+
#Qt detection
if (NOT DISABLE_QT)
find_package(Qt5Widgets)
@@ -191,22 +238,6 @@ if (NOT DISABLE_QT)
endif (Qt5Widgets_FOUND OR Qt5Quick_FOUND OR Qt5Sensors_FOUND)
endif (NOT DISABLE_QT)
-#pkg-config based detection
-find_package(PkgConfig)
-if(PKG_CONFIG_FOUND)
- pkg_check_modules(LIBLOCATION liblocation)
- pkg_check_modules(LIBOSSO libosso)
- # Accept even old versions of libgps, because N810 uses an old version (see #1179).
- pkg_check_modules(LIBGPS libgps)
- pkg_check_modules(LIBGPS19 libgps>=2.90)
- # libgpsd<V3.1 is buggy if LC_ALL is set.
- pkg_check_modules(LIBGPS_NEW libgps>=3.1)
- pkg_check_modules(LIBGARMIN libgarmin)
- pkg_check_modules(IMLIB2 imlib2)
- if(IMLIB2_FOUND)
- set(HAVE_IMLIB2 1)
- endif(IMLIB2_FOUND)
-endif(PKG_CONFIG_FOUND)
#Simple checks
CHECK_INCLUDE_FILES(wordexp.h HAVE_WORDEXP)
CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H)
@@ -256,18 +287,7 @@ if (CMAKE_USE_PTHREADS_INIT)
list(APPEND NAVIT_LIBS pthread)
endif(NOT ANDROID)
endif(CMAKE_USE_PTHREADS_INIT)
-if (Glib_FOUND)
- set(HAVE_GLIB 1)
- include_directories(${Glib_INCLUDE_DIRS})
- list(APPEND NAVIT_LIBS ${Glib_LIBRARIES})
-else(Glib_FOUND)
- set_with_reason(support/glib "Glib not found" TRUE ${INTL_LIBS})
-endif(Glib_FOUND)
-if (Gmodule_FOUND)
- set(HAVE_GMODULE 1)
- include_directories(${Gmodule_INCLUDE_DIRS})
- list(APPEND NAVIT_LIBS ${Gmodule_LIBRARIES})
-endif(Gmodule_FOUND)
+
if(ZLIB_FOUND)
set(HAVE_ZLIB 1)
include_directories(${ZLIB_INCLUDE_DIRS})
@@ -288,7 +308,7 @@ if (NOT HAVE_WORDEXP)
message(STATUS "wordexp.h not found. use internal wordexp")
set_with_reason(support/wordexp "native wordexp missing" TRUE)
endif()
-if (NOT Glib_FOUND)
+if (NOT GLIB2_FOUND)
set_with_reason(support/ezxml "Glib not found" TRUE)
endif()
@@ -440,13 +460,6 @@ if (LIBGARMIN_FOUND)
set_with_reason(map/garmin "Garmin library found" TRUE ${LIBGARMIN_LDFLAGS})
endif(LIBGARMIN_FOUND)
-if(DBusGLib_FOUND)
- include_directories(${DBusGLib_INCLUDE_DIRS})
- set_with_reason(binding/dbus "dbus-glib-1 found" TRUE ${DBusGLib_LIBRARIES})
- set_with_reason(speech/dbus "dbus-glib-1 found" TRUE ${DBusGLib_LIBRARIES})
- set_with_reason(vehicle/gpsd_dbus "dbus-glib-1 found" TRUE ${DBusGLib_LIBRARIES})
-endif()
-
if(PYTHONLIBS_FOUND)
set_with_reason(binding/python "python libraries [${PYTHONLIBS_VERSION_STRING}] found" TRUE ${PYTHON_LIBRARIES})
endif()