Guidelines and HOWTOs/CMake/Frameworks

From KDE Community Wiki
Revision as of 08:25, 28 July 2015 by *>Pippin (Created page with "This tutorial will show you how to use a [http://api.kde.org/frameworks-api/frameworks5-apidocs/ KDE Framework] in a CMake-based project. It will introduce you to searching fo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This tutorial will show you how to use a KDE Framework in a CMake-based project. It will introduce you to searching for external packages in CMake, and linking to libraries provided by those packages.

This will assume a basic familiarity with CMake; if you are completely unfamiliar with CMake, you should check out the first CMake project tutorial.

We start off the CMakeLists.txt file with the lines any CMake project needs:

cmake_minimum_required(VERSION 2.8.12)
project(UsingFrameworksTutorial)

Next, we search for the framework we want to use. We'll pick KArchive, a framework for dealing with compressed file formats.

find_package(KF5Archive)

Here, KF5Archive is the name of the package.