Commit ffb10f62 authored by Jan Grulich's avatar Jan Grulich
Browse files

CMake improvements

Requires lib[nm]-qt from framework branches
parent 2333fd45
......@@ -3,10 +3,8 @@ project(plasma-networkmanagement)
cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
set(QT_MIN_VERSION "5.2.0")
set(PLASMA_NM_VERSION_MAJOR 1)
set(PLASMA_NM_VERSION_MINOR 0)
set(PLASMA_NM_VERSION_PATCH 0)
set(PLASMA_NM_VERSION ${PLASMA_NM_VERSION_MAJOR}.${PLASMA_NM_VERSION_MINOR}.${PLASMA_NM_VERSION_PATCH} )
set(PLASMA_NM_VERSION 1.0.0)
set(PLASMA_NM_STRING_VERSION "${PLASMA_NM_VERSION}")
# With CMake older than version 3.1 pkg_check_modules ignores CMAKE_PREFIX_PATH
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
......@@ -14,90 +12,77 @@ include(FindPkgConfig)
################# set KDE specific information #################
find_package(ECM 0.0.8 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(ECM 0.0.12 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(CMakePackageConfigHelpers)
include(FeatureSummary)
include(WriteBasicConfigVersionFile)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
include(ECMOptionalAddSubdirectory)
find_package(Qt5 CONFIG REQUIRED COMPONENTS Core DBus Quick Widgets Designer Network Test)
pkg_check_modules(NETWORKMANAGER REQUIRED NetworkManager)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
DBus
Designer
Network
Test
Quick
Widgets
)
# Load CMake, Compiler and InstallDirs settings from KF5 and the following are already somewhat "done" tier1/tier2 libs from kdelibs:
find_package(KF5 CONFIG REQUIRED
I18n WindowSystem Service Completion WidgetsAddons KIO CoreAddons Wallet ItemViews XmlGui
ConfigWidgets IconThemes Solid DBusAddons Notifications Plasma Declarative Init KDE4Support)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
find_package(KF5NetworkManagerQt)
set_package_properties(KF5NetworkManagerQt PROPERTIES
TYPE REQUIRED)
pkg_check_modules(NETWORKMANAGER REQUIRED NetworkManager)
pkg_check_modules(NETWORKMANAGERQT5 REQUIRED NetworkManagerQt5)
find_package(KF5ModemManagerQt)
set_package_properties(KF5ModemManagerQt PROPERTIES
TYPE OPTIONAL)
if (NOT NETWORKMANAGERQT5_FOUND)
message(FATAL_ERROR "ERROR: NetworkManagerQt not found. http://projects.kde.org/libnm-qt")
endif (NOT NETWORKMANAGERQT5_FOUND)
find_package(MobileBroadbandProviderInfo)
set_package_properties(MobileBroadbandProviderInfo PROPERTIES
DESCRIPTION "Database of mobile broadband service providers"
URL "http://live.gnome.org/NetworkManager/MobileBroadband/ServiceProviders"
TYPE OPTIONAL)
if (DISABLE_MODEMMANAGER_SUPPORT)
message(STATUS "Disabling ModemManager support")
set(WITH_MODEMMANAGER_SUPPORT 0)
set(MODEMMANAGERQT5_FOUND false)
set(MODEMMANAGERQT5_LIBRARY "")
else()
pkg_check_modules(MODEMMANAGERQT5 ModemManagerQt5)
if (MODEMMANAGERQT5_FOUND)
if (KF5ModemManagerQt_FOUND)
message(STATUS "Enabling ModemManager support")
set(WITH_MODEMMANAGER_SUPPORT 1)
set(MODEMMANAGERQT5_LIBRARY ModemManagerQt5)
else()
message(STATUS "ModemManagerQt5 not found")
message(STATUS "ModemManagerQt not found")
set(WITH_MODEMMANAGER_SUPPORT 0)
endif()
endif()
# TODO
if (MODEMMANAGERQT5_FOUND)
find_package(MobileBroadbandProviderInfo)
set_package_properties(MobileBroadbandProviderInfo PROPERTIES
DESCRIPTION "Database of mobile broadband service providers"
URL "http://live.gnome.org/NetworkManager/MobileBroadband/ServiceProviders"
TYPE OPTIONAL)
endif()
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
remove_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_KEYWORDS)
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
add_definitions(
-DWITH_MODEMMANAGER_SUPPORT=${WITH_MODEMMANAGER_SUPPORT}
${QT_DEFINITIONS}
${KDE_DEFINITIONS}
${NETWORKMANAGERQT5_CFLAGS_OTHER}
)
add_definitions(-DWITH_MODEMMANAGER_SUPPORT=${WITH_MODEMMANAGER_SUPPORT})
include_directories(${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
include_directories(${CMAKE_CURRENT_BINARY_DIR} # for config.h
${CMAKE_CURRENT_SOURCE_DIR}/libs
${CMAKE_CURRENT_SOURCE_DIR}/libs/editor/
${NETWORKMANAGER_INCLUDE_DIRS}
${NETWORKMANAGERQT5_INCLUDE_DIRS}
${Qt5Designer_INCLUDE_DIRS})
if (MODEMMANAGERQT5_FOUND)
include_directories(
${MODEMMANAGER_INCLUDE_DIRS}
${MODEMMANAGERQT5_INCLUDE_DIRS}
)
${Qt5Designer_INCLUDE_DIRS}
${NETWORKMANAGER_INCLUDE_DIRS})
if (WITH_MODEMMANAGER_SUPPORT)
pkg_check_modules(MODEMMANAGER REQUIRED ModemManager>=1.0)
include_directories(${MODEMMANAGER_INCLUDE_DIRS})
endif()
add_subdirectory(applet)
......@@ -108,4 +93,3 @@ add_subdirectory(settings)
add_subdirectory(vpn)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
#cmakedefine PLASMA_NM_VERSION "@PLASMA_NM_VERSION@"
#define PLASMA_NM_VERSION_STRING "${PLASMA_NM_VERSION}"
......@@ -18,11 +18,11 @@ add_executable(kde-nm-connection-editor ${connectioneditor_SRCS})
target_link_libraries(kde-nm-connection-editor
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LDFLAGS}
Qt5::Widgets
Qt5::Network
Qt5::DBus
KF5::NetworkManagerQt
KF5::ModemManagerQt
KF5::Service
KF5::Completion
KF5::I18n
......
......@@ -37,7 +37,7 @@
int main(int argc, char *argv[])
{
K4AboutData about("kde-nm-connection-editor", 0, ki18n("Connection editor"),
PLASMA_NM_VERSION, ki18n("Manage your network connections"),
PLASMA_NM_VERSION_STRING, ki18n("Manage your network connections"),
K4AboutData::License_GPL, ki18n("(C) 2013-2014 Jan Grulich and Lukáš Tinkl"),
ki18n("This application allows you to create, edit and delete network connections.\n\nUsing NM version: %1")
.subs(NetworkManager::version()));
......@@ -57,7 +57,7 @@ int main(int argc, char *argv[])
QApplication app(KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv());
app.setApplicationName("kde-nm-connection-editor");
app.setApplicationVersion(PLASMA_NM_VERSION);
app.setApplicationVersion(PLASMA_NM_VERSION_STRING);
#warning "Translations for kde-nm-connection-editor disabled"
//KGlobal::insertCatalog("libplasmanetworkmanagement-editor"); // setting widgets
......
......@@ -33,12 +33,11 @@ add_library(kded_networkmanagement MODULE ${kded_networkmanagement_SRCS})
target_link_libraries(kded_networkmanagement
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LIBRARY}
Qt5::Widgets
Qt5::Network
Qt5::DBus
KF5::NetworkManagerQt
KF5::ModemManagerQt
KF5::Service
KF5::Solid
KF5::Completion
......
......@@ -16,9 +16,8 @@ add_library(plasmanetworkmanagement-internal SHARED ${plasmanetworkmanagement-in
target_link_libraries(plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LIBRARY}
KF5::NetworkManagerQt
KF5::ModemManagerQt
KF5::Solid
KF5::Completion
KF5::I18n
......
......@@ -13,14 +13,13 @@ set(plasma_networkmanagement_qml_plugins_SRCS
add_library(plasmanetworkmanagementplugins SHARED ${plasma_networkmanagement_qml_plugins_SRCS})
target_link_libraries(plasmanetworkmanagementplugins
${NETWORKMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LIBRARY}
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
Qt5::Quick
Qt5::DBus
Qt5::Network
KF5::NetworkManagerQt
KF5::ModemManagerQt
KF5::I18n
KF5::WindowSystem
)
......
......@@ -84,11 +84,11 @@ qt5_wrap_ui(plasmanetworkmanagement_libeditor_SRCS
add_library(plasmanetworkmanagement-editor SHARED ${plasmanetworkmanagement_libeditor_SRCS})
target_link_libraries(plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
${MODEMMANAGERQT5_LDFLAGS}
Qt5::Widgets
Qt5::Network
Qt5::DBus
KF5::NetworkManagerQt
KF5::ModemManagerQt
KF5::Service
KF5::Completion
KF5::I18n
......
......@@ -24,12 +24,6 @@
#include <NetworkManagerQt/Connection>
#include "plasmanm_export.h"
#include "config.h"
#if !WITH_MODEMMANAGER_SUPPORT
typedef QMap<QDBusObjectPath, NMVariantMapMap> NMDBusObjectVariantMapMap;
Q_DECLARE_METATYPE(NMDBusObjectVariantMapMap)
#endif
class PLASMA_NM_EXPORT Handler : public QObject
{
......
......@@ -15,7 +15,7 @@ target_link_libraries(plasmanetworkmanagementwidgets
KF5::I18n
KF5::ConfigWidgets
KF5::WidgetsAddons
KF5::KDE4Support
KF5::KDE4Support
)
install( TARGETS plasmanetworkmanagementwidgets DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/designer )
......@@ -15,10 +15,10 @@ kservice_desktop_to_json(plasmanetworkmanagement_l2tpui plasmanetworkmanagement_
target_link_libraries(plasmanetworkmanagement_l2tpui
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
Qt5::Widgets
Qt5::Network
Qt5::DBus
KF5::NetworkManagerQt
KF5::Service
KF5::Completion
KF5::I18n
......
......@@ -13,10 +13,10 @@ kservice_desktop_to_json(plasmanetworkmanagement_openswanui plasmanetworkmanagem
target_link_libraries(plasmanetworkmanagement_openswanui
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
Qt5::Widgets
Qt5::Network
Qt5::DBus
KF5::NetworkManagerQt
KF5::Service
KF5::Completion
KF5::I18n
......
......@@ -18,8 +18,8 @@ kservice_desktop_to_json(plasmanetworkmanagement_openvpnui plasmanetworkmanageme
target_link_libraries(plasmanetworkmanagement_openvpnui
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
Qt5::DBus
KF5::NetworkManagerQt
KF5::KIOCore
KF5::KIOWidgets
)
......
......@@ -13,10 +13,10 @@ kservice_desktop_to_json(plasmanetworkmanagement_pptpui plasmanetworkmanagement_
target_link_libraries(plasmanetworkmanagement_pptpui
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
Qt5::Widgets
Qt5::Network
Qt5::DBus
KF5::NetworkManagerQt
KF5::Service
KF5::Completion
KF5::I18n
......
......@@ -12,13 +12,13 @@ kservice_desktop_to_json(plasmanetworkmanagement_strongswanui plasmanetworkmanag
target_link_libraries(plasmanetworkmanagement_strongswanui
plasmanetworkmanagement-editor
plasmanetworkmanagement-internal
Qt5::Widgets
KF5::Service
KF5::I18n
KF5::KIOWidgets
KF5::KDE4Support
${NETWORKMANAGERQT5_LDFLAGS}
plasmanetworkmanagement-internal
KF5::NetworkManagerQt
)
install(TARGETS plasmanetworkmanagement_strongswanui DESTINATION ${PLUGIN_INSTALL_DIR}/plasmanetworkmanagement/vpnuiplugin)
......
......@@ -14,10 +14,10 @@ kservice_desktop_to_json(plasmanetworkmanagement_vpncui plasmanetworkmanagement_
target_link_libraries(plasmanetworkmanagement_vpncui
plasmanetworkmanagement-internal
plasmanetworkmanagement-editor
${NETWORKMANAGERQT5_LDFLAGS}
Qt5::Widgets
Qt5::Network
Qt5::DBus
KF5::NetworkManagerQt
KF5::Service
KF5::Completion
KF5::I18n
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment