On Friday 08 February 2013, Alexander Neundorf wrote:
> Hi,
> 
> after looking at the current plasma-framework buildsystem I worked a bit on
> the kdelibs and plasma buildsystem, and there is now a somewhat sane way to
> use an installed kdelibs from the frameworks branch.
> 
> So, compared to kdelibs before, now FindKDE4Internal.cmake is no longer
> installed.
> Instead kdelibs now installs a KDELibs4Config.cmake, which (still) contains
> most of what was in FindKDE4Internal.cmake.
> KDELibs4Config.cmake is installed into lib/cmake/KDELibs4/, i.e. in a
> directory where cmake searches for Config.cmake files in NO_MODULE mode.
> 
> KDELibs4Config.cmake does not contain cmake- or compiler settings anymore.
> This must now come from extra-cmake-modules by finding KF5:
> 
> find_package(KF5 MODULE REQUIRED CMake Compiler InstallDirs)
> 
> This "finds" KF5 and the meta-components
> * CMake : cmake settings, e.g. RPATH handling
> * Compiler : the compiler switches we had in FindKDE4Internal.cmake
> * InstallDirs : the install dir variables as they were in
> FindKDE4Internal.cmake
> 
> When searching KDELibs4, the tier1 libraries and ki18n the order matters.
> 
> The tier1 libs don't depend on anything, so they must be searched first.
> ki18n must also be searched before KDELibs4, because libraries in KDELibs4
> depend on it, and it fails otherwise.
> 
> What I committed/pushed is not perfect, but at least somewhat sane, and it
> kind of works.
> 
> Let me know if it doesn't for you.

Attached is a minimal example of how to use it.

Alex
cmake_minimum_required(VERSION 2.8.10)

# first search extra-cmake-modules.
# This provides the Find-modules FindQt5Transitional.cmake
# and FindKF5.cmake, which can load also all KF5 frameworks as components.

find_package(ECM 0.0.7 NO_MODULE REQUIRED)

set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

find_package(Qt5Transitional MODULE REQUIRED Core Widgets)

# Use the CMake and Compiler settings and also the install destination
# variables from KDE. Additionally load itemmodels and karchive.
find_package(KF5 MODULE QUIET REQUIRED CMake Compiler InstallDirs itemmodels karchive)

include_directories(${KF5_INCLUDE_DIRS})

add_executable(hello main.cpp)

target_link_libraries(hello ${QT_LIBRARIES} ${KF5_LIBRARIES})
#include <stdio.h>

int main()
{
   printf("hello kf5 !\n");
   return 0;
}
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to