Commit c4f1fe5d authored by Alex Richardson's avatar Alex Richardson

Adapt CMakeLists to compile with Qt5/KF5

parent e7fe3169
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8.11.1)
project( okteta )
find_package(KDE4 REQUIRED)
#copy the way kde-workspace does it
set(QT_MIN_VERSION "5.2.0")
find_package(ECM 0.0.8 REQUIRED NO_MODULE)
include(CMakePackageConfigHelpers)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH})
find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Widgets Script ScriptTools)
find_package(Qt5Transitional MODULE)
#workaround wrong dirs being used
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0) #allow deprecated functions for now
find_package(kdeqt5staging REQUIRED NO_MODULE)
# Load CMake, Compiler and InstallDirs settings from KF5 and the following are already somewhat "done" tier1/tier2 libs from kdelibs:
find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs
KWidgetsAddons KCoreAddons KConfig KI18n KGuiAddons KService ItemViews KConfigWidgets
KWindowSystem KNotifications KAuth KCodecs KWidgets KIconThemes Sonnet KCompletion
KTextWidgets XmlGui KDBusAddons KCrash KArchive ItemModels KJobWidgets Solid KWallet KJS
)
# needed for set_package_properties macro
find_package(LibAttica REQUIRED NO_MODULE ) #somehow this is not searched for
find_package(KDELibs4 REQUIRED NO_MODULE) #needed for KDE4Support
find_package(KDE4Support REQUIRED NO_MODULE)
find_package(KDE4Attic REQUIRED NO_MODULE)
include(KDE4Defaults)
include(MacroLibrary)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) #this is needed since it is apparently not set by Qt5Config.cmake
#don't add KDE4Support manually to every target
set(KDE4_KDECORE_LIBS ${KDE4_KDECORE_LIBS} ${KDE4Support_LIBRARIES})
set(KDE4_KDEUI_LIBS ${KDE4_KDEUI_LIBS} ${KDE4Support_LIBRARIES})
set(KDE4_KIO_LIBS ${KDE4_KIO_LIBS} ${KDE4Support_LIBRARIES})
macro_optional_find_package( QCA2 )
macro_log_feature( QCA2_FOUND "QCA2" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca" FALSE "2.0.0" "Needed for most of the algorithms of the checksum tool." )
......
......@@ -112,18 +112,12 @@ set( oktetacore_LIB_CCHDRS
includes/CharCodec
)
#TODO remove once CMake >= 2.8.9 is required for building KDE
#don't compile sources twice
if ( CMAKE_VERSION VERSION_GREATER 2.8.8)
#OBJECT libraries seem buggy with regard to automoc, have to call it manually
automoc4( oktetacore_objs oktetacore_LIB_SRCS )
add_library( oktetacore_objs OBJECT ${oktetacore_LIB_SRCS} )
set_target_properties(oktetacore_objs PROPERTIES POSITION_INDEPENDENT_CODE ON)
set( oktetacore_LIB_OBJS $<TARGET_OBJECTS:oktetacore_objs>)
else()
#compile the sources twice for older CMake version
set( oktetacore_LIB_OBJS ${oktetacore_LIB_SRCS})
endif()
#don't compile sources twice by using object libraries
#OBJECT libraries seem buggy with regard to automoc, have to call it manually
#automoc4( oktetacore_objs oktetacore_LIB_SRCS )
add_library( oktetacore_objs OBJECT ${oktetacore_LIB_SRCS} )
set_target_properties(oktetacore_objs PROPERTIES POSITION_INDEPENDENT_CODE ON)
set( oktetacore_LIB_OBJS $<TARGET_OBJECTS:oktetacore_objs>)
kde4_add_library( ${oktetacore_LIB} SHARED ${oktetacore_LIB_OBJS} )
target_link_libraries( ${oktetacore_LIB}
......
......@@ -25,5 +25,7 @@
// Qt
#include <QtCore/QtPlugin>
#pragma message("TODO: Q_EXPORT_PLUGIN2 does not work with Qt5, fix it")
#if 0
Q_EXPORT_PLUGIN2( oktetadesignerplugin, OktetaWidgetDesignerFactoryCollection )
#endif
......@@ -394,21 +394,17 @@ set( VIEWPROFILESMANAGECONTROLLER_SRCS
#structview and poddecoder sources are also needed for structures tool unit tests
#create a OBJECT library (http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library)
#to prevent compiling these object files twice with exactly the same compile flags
#TODO remove once CMake >= 2.8.9 is required for building KDE
if ( CMAKE_VERSION VERSION_GREATER 2.8.8)
#OBJECT libraries seem buggy with regard to automoc, have to call it manually
automoc4( poddecoder_objs PODDECODERCONTROLLER_SRCS )
automoc4( structview_objs STRUCTVIEW_SRCS )
add_library( poddecoder_objs OBJECT ${PODDECODERCONTROLLER_SRCS} )
add_library( structview_objs OBJECT ${STRUCTVIEW_SRCS} )
set_target_properties(poddecoder_objs structview_objs PROPERTIES POSITION_INDEPENDENT_CODE ON)
set( PODDECODER_OBJS $<TARGET_OBJECTS:poddecoder_objs>)
set( STRUCTVIEW_OBJS $<TARGET_OBJECTS:structview_objs>)
else()
#compile the sources twice for older CMake version
set( PODDECODER_OBJS ${PODDECODERCONTROLLER_SRCS})
set( STRUCTVIEW_OBJS ${STRUCTVIEW_SRCS})
endif()
#OBJECT libraries seem buggy with regard to automoc, have to call it manually
#automoc4( poddecoder_objs PODDECODERCONTROLLER_SRCS )
#automoc4( structview_objs STRUCTVIEW_SRCS )
add_library( poddecoder_objs OBJECT ${PODDECODERCONTROLLER_SRCS} )
add_library( structview_objs OBJECT ${STRUCTVIEW_SRCS} )
set_target_properties(poddecoder_objs structview_objs PROPERTIES POSITION_INDEPENDENT_CODE ON)
set( PODDECODER_OBJS $<TARGET_OBJECTS:poddecoder_objs>)
set( STRUCTVIEW_OBJS $<TARGET_OBJECTS:structview_objs>)
set( OKTETA_KASTEN_CONTROLLERS_SRCS
# ${OVERWRITEONLYCONTROLLER_SRCS}
......@@ -554,6 +550,7 @@ target_link_libraries( ${oktetakastencontrollers_LIB}
${KDE4_KCMUTILS_LIBS}
${QT_QTSCRIPT_LIBRARY}
${QT_QTSCRIPTTOOLS_LIBRARY}
${KDE4Attic_LIBRARIES}
)
if( QCA2_FOUND )
target_link_libraries( ${oktetakastencontrollers_LIB} ${QCA2_LIBRARIES} )
......
......@@ -21,7 +21,7 @@
**
****************************************************************************/
#include <QtGui/QtGui>
#include <QtWidgets>
#include "modeltest.h"
......
......@@ -185,6 +185,7 @@ target_link_libraries( ${kastencontrollers_LIB}
${kastencore_LIB}
${KDE4_KPARTS_LIBS}
${KDE4_KFILE_LIBS}
${KDE4Support_LIBRARIES}
)
set_target_properties( ${kastencontrollers_LIB} PROPERTIES
OUTPUT_NAME ${kastencontrollers_LIB_NAME}
......
......@@ -127,6 +127,7 @@ kde4_add_library( ${kastencore_LIB} SHARED ${kastencore_LIB_SRCS} )
target_link_libraries( ${kastencore_LIB}
${KDE4_KIO_LIBS}
${KDE4_SOLID_LIBS}
Qt5::Widgets
)
set_target_properties( ${kastencore_LIB} PROPERTIES
OUTPUT_NAME ${kastencore_LIB_NAME}
......
......@@ -37,6 +37,8 @@ bool JobManager::executeJob( KJob* job )
if( ! job )
return false;
//TODO linking to QtWidgets in core library should be avoided
#pragma message("TODO: no longer link to QtWidgets")
QApplication::setOverrideCursor( Qt::WaitCursor );
job->exec();
......
......@@ -7,5 +7,5 @@ set( beiftest_SRCS beiftest.cpp )
kde4_add_executable(beiftest TEST ${beiftest_SRCS} )
target_link_libraries( beiftest ${KDE4_KPARTS_LIBS} )
target_link_libraries( beiftest ${KDE4_KPARTS_LIBS} ${KDE4Support_LIBRARIES} )
......@@ -52,6 +52,7 @@ target_link_libraries( oktetapart
kastengui
kastencore
${KDE4_KPARTS_LIBS}
${KDE4Support_LIBRARIES}
)
install( TARGETS oktetapart DESTINATION ${PLUGIN_INSTALL_DIR})
......
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