diff options
author | rikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-01-04 14:26:50 +0000 |
---|---|---|
committer | rikky <rikky@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2011-01-04 14:26:50 +0000 |
commit | e963aeeb4722af1c61647adc32751400f2807709 (patch) | |
tree | 2878f343085a437b1281730c1d9ea25a14b577c8 | |
parent | f60d0e3749b7e20175543b96a90c4f45771e0b77 (diff) | |
download | navit-svn-e963aeeb4722af1c61647adc32751400f2807709.tar.gz |
Fix:Build:Fix cmake build to link external libraries to plugins/modules which depend on it, not to navit_core.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3858 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r-- | CMakeLists.txt | 30 | ||||
-rw-r--r-- | cmake/navit_macros.cmake | 7 | ||||
-rw-r--r-- | navit/graphics/qt_qpainter/CMakeLists.txt | 8 |
3 files changed, 19 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 997f4172..54e38f2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,10 +113,11 @@ endif(FREETYPE_FOUND) if (QT_FOUND) if (QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND FREETYPE_FOUND) - set_with_reason(graphics/qt_qpainter "Qt libraries found" TRUE) + include(${QT_USE_FILE}) + set_with_reason(graphics/qt_qpainter "Qt libraries found" TRUE ${QT_LIBRARIES}) if (QT_QTDECLARATIVE_FOUND AND QT_QTXML_FOUND) - set_with_reason(gui/qml "Qt Declarative found" TRUE) + set_with_reason(gui/qml "Qt Declarative found" TRUE ${QT_LIBRARIES}) endif() if (QT_QTSVG_FOUND) @@ -124,19 +125,15 @@ if (QT_FOUND) elseif( USE_SVG AND graphics/qt_qpainter) message( WARNING "QT compiled without SVG support") endif() - - include(${QT_USE_FILE}) - list(APPEND NAVIT_LIBS ${QT_LIBRARIES}) endif() endif(QT_FOUND) if(GTK2_FOUND) include_directories(${GTK2_INCLUDE_DIRS}) - list(APPEND NAVIT_LIBS ${GTK2_LIBRARIES}) set(HAVE_GTK2 1) - set_with_reason(gui/gtk "GTK libs found" TRUE) + set_with_reason(gui/gtk "GTK libs found" TRUE ${GTK2_LIBRARIES}) if(FREETYPE_FOUND) - set_with_reason(graphics/gtk_drawing_area "GTK libs found" TRUE) + set_with_reason(graphics/gtk_drawing_area "GTK libs found" TRUE ${GTK2_LIBRARIES}) endif(FREETYPE_FOUND) endif(GTK2_FOUND) @@ -153,13 +150,12 @@ else() endif(QUESOGLC_FOUND AND FREETYPE_FOUND) if(SDL_FOUND AND SDLIMAGE_FOUND AND FREE_TYPE_FOUND) - set_with_reason(graphics/sdl "SDL/SDL_image libs found" TRUE) - list(APPEND NAVIT_LIBS ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY}) set(SDL_IMAGE 1) if(SDLTTF_FOUND) set(SDL_TTF 1) - list(APPEND NAVIT_LIBS ${SDLTTF_LIBRARY}) + list(APPEND SDL_LIBRARY ${SDLTTF_LIBRARY}) endif(SDLTTF_FOUND) + set_with_reason(graphics/sdl "SDL/SDL_image libs found" TRUE ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY}) endif(SDL_FOUND AND SDLIMAGE_FOUND AND FREE_TYPE_FOUND) if (HAVE_LIBGPS) @@ -172,14 +168,13 @@ endif(GYPSY_FOUND) if(DBusGLib_FOUND) include_directories(${DBusGLib_INCLUDE_DIRS}) - list(APPEND NAVIT_LIBS ${DBusGLib_LIBRARIES}) - set_with_reason(binding/dbus "dbus-glib-1 found" TRUE) - set_with_reason(speech/dbus "dbus-glib-1 found" TRUE) - set_with_reason(vehicle/gpsd_dbus "dbus-glib-1 found" TRUE) + 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 (HAVE_LIBSPEECHD) - set_with_reason(speech/speech_dispatcher "speech_dispatcher lib found" TRUE) + set_with_reason(speech/speech_dispatcher "speech_dispatcher lib found" TRUE speechd) endif(HAVE_LIBSPEECHD) #Independent modules @@ -311,10 +306,11 @@ endif(SVG2PNG) if(USE_PLUGINS) set(MODULE_BUILD_TYPE "MODULE") list(APPEND NAVIT_COMPILE_FLAGS -fPIC) - message(STATUS "Use plugins: ${MODULE_BUILD_TYPE}") + list(APPEND NAVIT_LIBS dl) else() set(MODULE_BUILD_TYPE "STATIC") endif(USE_PLUGINS) +message(STATUS "Use plugins: ${MODULE_BUILD_TYPE}") CHECK_INCLUDE_FILES (malloc.h HAVE_MALLOC_H) CHECK_INCLUDE_FILES ("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H) diff --git a/cmake/navit_macros.cmake b/cmake/navit_macros.cmake index 0f4ef09f..432839be 100644 --- a/cmake/navit_macros.cmake +++ b/cmake/navit_macros.cmake @@ -1,6 +1,8 @@ -macro(set_with_reason VARIABLE REASON) - set(${VARIABLE} ${ARGN}) +macro(set_with_reason VARIABLE REASON ENABLE) + set(${VARIABLE} ${ENABLE}) set(${VARIABLE}_REASON ${REASON}) + string(REPLACE "/" "_" VARIABLE_NAMES ${VARIABLE}) + set(${VARIABLE_NAMES}_LIBS ${ARGN}) endmacro() # modules may be linked static, or shared for import at runtime @@ -20,6 +22,7 @@ endmacro() macro(module_add_library MODULE_NAME ) add_library(${MODULE_NAME} ${MODULE_BUILD_TYPE} ${ARGN}) SET_TARGET_PROPERTIES(${MODULE_NAME} PROPERTIES COMPILE_DEFINITIONS "MODULE=${MODULE_NAME}") + TARGET_LINK_LIBRARIES(${MODULE_NAME} ${${MODULE_NAME}_LIBS}) if (USE_PLUGINS) SET_TARGET_PROPERTIES( ${MODULE_NAME} PROPERTIES COMPILE_FLAGS ${NAVIT_COMPILE_FLAGS}) diff --git a/navit/graphics/qt_qpainter/CMakeLists.txt b/navit/graphics/qt_qpainter/CMakeLists.txt index c4fadc1f..4635604d 100644 --- a/navit/graphics/qt_qpainter/CMakeLists.txt +++ b/navit/graphics/qt_qpainter/CMakeLists.txt @@ -1,10 +1,4 @@ -# Create a library called "Hello" which includes the source file "hello.cxx". -# The extension is already found. Any number of sources could be listed here. - -add_definitions( -DMODULE=graphics_qt_qpainter ) - +module_add_library(graphics_qt_qpainter ${CMAKE_CURRENT_BINARY_DIR}/graphics_qt_qpainter.moc graphics_qt_qpainter.cpp) QT4_GENERATE_MOC(graphics_qt_qpainter.cpp ${CMAKE_CURRENT_BINARY_DIR}/graphics_qt_qpainter.moc) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) -add_library(graphics_qt_qpainter ${MODULE_BUILD_TYPE} ${CMAKE_CURRENT_BINARY_DIR}/graphics_qt_qpainter.moc graphics_qt_qpainter.cpp ) |