[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Trying to use a KDE lib but stymied by CMake [solved]



On Sat, Nov 26, 2022 at 11:55 AM Ross Boylan
<rossboylan@stanfordalumni.org> wrote:
>
> I am trying to compile a program that calls libkpmcore; it is not
> graphical.  My main interest is in tracing through what scandevices()
> does.
> Since KDE uses CMake, I figured I should too.  But I'm having trouble
> getting the include paths (and quite possibly the libraries if I get
> past that) into the compiler

The general KDE Frameworks tutorial,
https://community.kde.org/Guidelines_and_HOWTOs/CMake/Frameworks, says
the target_link_libraries declaration "will not only link the tutorial
target against the KArchive library, it will set up the include paths
properly as well."  This suggests that target_link_libraries takes
care of things for other projects as well.  That isn't quite true for
KPMcore;  KPMcore's README says an explicit include is necessary too,
and I verified it is necessary even with the target_link_libraries.
But once I added

target_link_libraries(mypm
    PRIVATE
    kpmcore
)

all the other matters, like the include path for Qt, took care of themselves.

The README for the KPMcore doesn't really have enough info to get a
program working, but there are some test programs that do:
https://bugs.kde.org/show_bug.cgi?id=462611

Still don't know if there's a way to get cmake --help-module to give
useful info.

Ross


Reply to: