From 77a25f294ec11f00f5be890700a63c093d4f781b Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Mon, 1 Sep 2008 22:46:04 +0200 Subject: [PATCH] Fix MOC defines for cmake-2.4. This fixes building without OpenSSL and cmake-2.4 Also making OpenSSL and D-Bus detection slightly more verbose, and don't clean qrc_i18n.cxx anymore. --- CMakeLists.txt | 26 ++++++++++++++----- cmake/modules/FindQt4.cmake | 16 +++++++++--- .../modules/QuasselGenerateTranslations.cmake | 5 ++-- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69945fc9..04aa07ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,24 +126,38 @@ set(QT_DONT_USE_QTGUI 1) include(${QT_USE_FILE}) include_directories(${QT_INCLUDES}) -# Set up OpenSSL +# Setup OpenSSL if(WITH_OPENSSL) find_package(OpenSSL) +else(WITH_OPENSSL) + message(STATUS "Disabling OpenSSL support") endif(WITH_OPENSSL) + if(OPENSSL_FOUND) if(NOT QT_DEFINITIONS MATCHES "QT_NO_OPENSSL") + message(STATUS "Found OpenSSL support in Qt") add_definitions(-DHAVE_SSL) set(HAVE_SSL true) + else(NOT QT_DEFINITIONS MATCHES "QT_NO_OPENSSL") + message(STATUS "No OpenSSL support found in Qt, disabling") endif(NOT QT_DEFINITIONS MATCHES "QT_NO_OPENSSL") else(OPENSSL_FOUND) add_definitions(-DQT_NO_OPENSSL) endif(OPENSSL_FOUND) -if(WITH_DBUS AND QT_QTDBUS_FOUND) - add_definitions(-DHAVE_DBUS) - set(LINK_DBUS DBUS) - set(HAVE_DBUS true) -endif(WITH_DBUS AND QT_QTDBUS_FOUND) +# Setup D-Bus support +if(WITH_DBUS) + if(QT_QTDBUS_FOUND) + message(STATUS "Found QtDBus, enabling D-Bus support") + add_definitions(-DHAVE_DBUS) + set(LINK_DBUS DBUS) + set(HAVE_DBUS true) + else(QT_QTDBUS_FOUND) + message(STATUS "QtDBus not found, disabling D-Bus support") + endif(QT_QTDBUS_FOUND) +else(WITH_DBUS) + message(STATUS "Disabling D-Bus support") +endif(WITH_DBUS) # We need to create a version.gen # For this, we create our genversion binary and make sure it is run every time. diff --git a/cmake/modules/FindQt4.cmake b/cmake/modules/FindQt4.cmake index 6c1dd86c..1def7f44 100644 --- a/cmake/modules/FindQt4.cmake +++ b/cmake/modules/FindQt4.cmake @@ -1144,11 +1144,19 @@ IF (QT4_QMAKE_FOUND) # Added by Sput to provide definitions to moc calls MACRO (QT4_GET_MOC_DEFINES _moc_DEFINES) - SET(${_moc_DEFINES}) - GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) - FOREACH(_current ${_defines}) + SET(${_moc_DEFINES}) + if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6) + GET_DIRECTORY_PROPERTY(_defines DEFINITIONS) + SEPARATE_ARGUMENTS(_defines) + FOREACH(_current ${_defines}) + SET(${_moc_DEFINES} ${${_moc_DEFINES}} ${_current}) + ENDFOREACH(_current ${_defines}) + else(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6) + GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) + FOREACH(_current ${_defines}) SET(${_moc_DEFINES} ${${_moc_DEFINES}} -D${_current}) - ENDFOREACH(_current ${_defines}) + ENDFOREACH(_current ${_defines}) + endif(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 6) ENDMACRO(QT4_GET_MOC_DEFINES) diff --git a/cmake/modules/QuasselGenerateTranslations.cmake b/cmake/modules/QuasselGenerateTranslations.cmake index 99c87a3b..5d9ef8ee 100644 --- a/cmake/modules/QuasselGenerateTranslations.cmake +++ b/cmake/modules/QuasselGenerateTranslations.cmake @@ -53,8 +53,8 @@ macro(quassel_generate_i18n_resource outvar) endforeach(file ${outfiles}) file(APPEND ${resfile} "\n\n") add_custom_command(OUTPUT ${resfile} DEPENDS ${outfiles}) - set_directory_properties(PROPERTIES - ADDITIONAL_MAKE_CLEAN_FILES "${outfiles} i18n.qrc") +# set_directory_properties(PROPERTIES +# ADDITIONAL_MAKE_CLEAN_FILES "${outfiles} i18n.qrc") # Generate resource qt4_add_resources(RC_OUT ${resfile}) @@ -65,4 +65,3 @@ macro(quassel_generate_i18n_resource outvar) message(STATUS "WARNING: lrelease not found, you won't have translations!") endif(QT_LRELEASE_EXECUTABLE) endmacro(quassel_generate_i18n_resource outvar) - -- 2.20.1