CMake, KF5_INCLUDE_DIRS empty?

Stephen Kelly steveire at gmail.com
Mon Oct 21 09:25:13 UTC 2013


Mark wrote:

> On Sun, Oct 20, 2013 at 11:42 AM, David Faure <faure at kde.org> wrote:
>> On Sunday 13 October 2013 17:18:28 Mark wrote:
>>> Hi,
>>>
>>> I used to rely on KF5_INCLUDE_DIRS but since a few days that variable
>>> seems to be empty. Did i do something wrong?
>>>
>>> My CMake file for the relevant parts:
>>>
>>> find_package(ECM REQUIRED NO_MODULE)
>>> set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
>>> find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs
>>> KBookmarks XmlGui Solid KIO)
>>> include_directories(${KF5_INCLUDE_DIRS})
>>>
>>> KF5_INCLUDE_DIRS used to contain a bunch of paths a few days ago.

When I saw this mail, I almost posted a link to 

 http://www.macieira.org/blog/2012/05/doesnt-work-doesnt-work/

because your mail didn't specify what the problem was.

Then I realized that your mail didn't actually say that there was a problem 
at all, so I didn't.

Your test case above is not complete. See

 http://sscce.org/

>>
>> I don't know much about this variable, but it shouldn't be needed anyway.
>> Just linking to the appropriate targets (e.g. KF5::KBookmarks) should
>> bring in the corresponding include dirs.
> 
> After hours of CMake debugging i finally found the reason for the
> variable to be empty [1].

I'm glad you found the cause and more info. Looking at gitk would have saved 
you some hours I guess, as would looking at the output 
of 'git log -S INCLUDE_DIRS'.

> However, when i add in KIO (or KIOCore) or any known KIO thing i still
> am welcomed by by an error that KIO/Job could not be found...
> 
> Before the commit [1] i used to just add ${KF5_INCLUDE_DIRS} to my
> include dirs which would pick everything up. Right now when i compile
> with KIO added like this:
> find_package(KF5 MODULE REQUIRED ... KIO ...)
> target_link_libraries(project
>     ... other libs ...
>     kio
>     kiocore
>     KF5::KIOCore
>     KF5::KIOWidgets
> )
> 
> When compiling it includes some paths, but certainly not the one where
> KIO is hidden. I only see:
> -I/home/kde-devel/kf5/include
> 
> KIO is hidden at:
> -I/home/kde-devel/kf5/include/KDE
> 
> using kio/job.h as includes works just fine. Using KIO/Job does not.
> Do you happen to know a solution here?

add
 
 target_include_directories(foo 
   PUBLIC 
     "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/KDE>"
 )

to whatever foo needs a KDE/ include.

There is a more-generic solution, but currently there are several 
inconsistencies in 'where do we put includes' and 'what include directories 
should the user use'.

Thanks,

Steve.




More information about the Kde-frameworks-devel mailing list