From 4b96395e7f88f58cd2a9b3f1fda329b958e96023 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 24 Jul 2010 12:35:21 +0000 Subject: [PATCH] Add an option to use the system qxt library --- CMakeLists.txt | 22 ++++++++++++++++++---- src/CMakeLists.txt | 4 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a70696b25..2f630ba14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,6 @@ if (WIN32) SET(CMAKE_RC_COMPILE_OBJECT " -O coff -o -I../../dist/windows") endif(WIN32) -add_definitions(-DQXT_STATIC -DBUILD_QXT_GUI -DBUILD_QXT_CORE) add_definitions(-DQT_NO_CAST_TO_ASCII) # Translations stuff @@ -181,11 +180,26 @@ if(NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES) set(QTIOCOMPRESSOR_LIBRARIES qtiocompressor) endif(NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES) +# When/if upstream accepts our or reimplement our patches then these options can be +# used to link to system installed qxt instead. +option(USE_SYSTEM_QXT "Don't set this option unless your system Qxt library has been compiled with the Clementine patches in 3rdparty" OFF) +if (USE_SYSTEM_QXT) + find_path(QXTCORE_INCLUDE_DIRS qxtglobal.h PATH_SUFFIXES QxtCore) + find_path(QXTGUI_INCLUDE_DIRS qxtglobalshortcut.h PATH_SUFFIXES QxtGui) + set(QXT_INCLUDE_DIRS ${QXTCORE_INCLUDE_DIRS} ${QXTGUI_INCLUDE_DIRS}) + # We only need its header. We don't need to link to QxtCore. + find_library(QXT_LIBRARIES QxtGui) +else (USE_SYSTEM_QXT) + if (NOT APPLE) + add_subdirectory(3rdparty/qxt) + add_definitions(-DQXT_STATIC -DBUILD_QXT_GUI -DBUILD_QXT_CORE) + set(QXT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/qxt) + set(QXT_LIBRARIES qxt) + endif (NOT APPLE) +endif (USE_SYSTEM_QXT) + # Subdirectories add_subdirectory(src) -if (NOT APPLE) - add_subdirectory(3rdparty/qxt) -endif (NOT APPLE) add_subdirectory(3rdparty/qtwin) add_subdirectory(3rdparty/universalchardet) add_subdirectory(tests) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 08b5025b9..1608fce1a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,7 +7,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${SPARKLE}) include_directories(../3rdparty/gmock/gtest/include) include_directories(../3rdparty/qtwin) -include_directories(../3rdparty/qxt) include_directories(${GLIB_INCLUDE_DIRS}) include_directories(${LIBXML_INCLUDE_DIRS}) @@ -15,6 +14,7 @@ include_directories(${GOBJECT_INCLUDE_DIRS}) include_directories(${LIBPROJECTM_INCLUDE_DIRS}) include_directories(${QTSINGLEAPPLICATION_INCLUDE_DIRS}) include_directories(${QTIOCOMPRESSOR_INCLUDE_DIRS}) +include_directories(${QXT_INCLUDE_DIRS}) cmake_policy(SET CMP0011 NEW) include(../cmake/AddEngine.cmake) @@ -572,7 +572,7 @@ if (APPLE) ) include_directories(${SPARKLE}/Headers) else (APPLE) - target_link_libraries(clementine_lib qxt) + target_link_libraries(clementine_lib ${QXT_LIBRARIES}) endif (APPLE) # Link against the qsqlite plugin on windows and mac