KF5 CMake usage question

Shaheed Haque srhaque at theiet.org
Sat May 13 17:06:07 BST 2017


Hi,

I'm a bit confused as to how the current KF5 CMake support works. I
have a small fragment that looks like this:

    find_package(KF5KIO REQUIRED)
    message(STATUS "KF5KIO includes = ${KF5KIO_INCLUDE_DIRS}")

The printed output shows that the variable KF5KIO_INCLUDE_DIRS is not
set. In poking around, I see references to a (new-to-me) target-based
system, and using that like this:

    find_package(ECM REQUIRED NO_MODULE)
    set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
    find_package(KF5 MODULE REQUIRED COMPONENTS KIO)
    get_target_property(hello KF5::KIOCore INTERFACE_INCLUDE_DIRECTORIES)
    message(STATUS "KF5KIO includes = ${hello}")

I now see some useful output. However, note that here I did a
find_package() on KF5 and KIO, but that I had to do a
get_target_property() on KF5::KIOCore. I don't see a programmatic way
to get from (KF5, KIO) to (KF5::KIOCore).

Is there some other way programmatically to get to the include
directories and compile flags for each framework in KF5?

Thanks, Shaheed

P.S. I do see this thread
https://cmake.org/pipermail/cmake-developers/2013-July/019592.html,
which seems to suggest that there should be a variable called
${Foo_TARGETS}, but I've not been able to work out what "Foo" should
be in either case (plus, it is the include directories and compile
flags I am presently interested in, not the libraries).




More information about the kde-core-devel mailing list