Bug 407163

Summary: compilation fails due to wrong include statement
Product: [Applications] kmail2 Reporter: Jos van den Oever <jos>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: montel
Priority: NOR    
Version: 5.11.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.11.2

Description Jos van den Oever 2019-05-02 18:49:09 UTC
SUMMARY

include/KF5/mailcommon/backupjob.h contains this include statement:

#include "libkdepim/progressmanager.h"

When compiling KMail 5.11 on NixOS 19.03, this compilation error is given:

/nix/store/zikg7mfgx01isvw6qzi969f1a1yhr7m3-mailcommon-19.04.0-dev/include/KF5/mailcommon/backupjob.h:25:10: fatal error: libkdepim/progressmanager.h: No such file or directory
 #include "libkdepim/progressmanager.h"

that is because the directory .../include/KF5/libkdepim is given in KF5LibkdepimTargets.cmake, but not the parent directory .../include/KF5.

There are two solutions:

 1) adapt backupjob.h
 2) adapt KF5LibkdepimTargets.cmake

I'm compiling this on NixOS 19.03.
Comment 1 Jos van den Oever 2019-05-02 20:24:48 UTC
This patch to kmail solves the issue (and one other similar issue):


diff --git a/agents/archivemailagent/CMakeLists.txt b/agents/archivemailagent/CMakeLists.txt
index 48ed076..9c56896 100644
--- a/agents/archivemailagent/CMakeLists.txt
+++ b/agents/archivemailagent/CMakeLists.txt
@@ -22,6 +22,7 @@ ki18n_wrap_ui(libarchivemailagent_SRCS ui/archivemailwidget.ui )
 add_library(archivemailagent STATIC ${libarchivemailagent_SRCS})
 target_link_libraries(archivemailagent
     KF5::MailCommon
+    KF5::Libkdepim
     KF5::I18n
     KF5::Notifications
     KF5::IconThemes
diff --git a/agents/followupreminderagent/CMakeLists.txt b/agents/followupreminderagent/CMakeLists.txt
index a56b730..83604cf 100644
--- a/agents/followupreminderagent/CMakeLists.txt
+++ b/agents/followupreminderagent/CMakeLists.txt
@@ -23,6 +23,7 @@ target_link_libraries(followupreminderagent
     KF5::AkonadiMime
     KF5::AkonadiAgentBase
     KF5::DBusAddons
+    KF5::FollowupReminder
     KF5::XmlGui
     KF5::KIOWidgets
     KF5::Notifications
Comment 2 Laurent Montel 2019-05-09 06:58:30 UTC
when I look at "src/libkdepim/CMakeFiles/Export/lib64/cmake/KF5Libkdepim/KF5LibkdepimTargets.cmake"
I have it:

set_target_properties(KF5::Libkdepim PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/KF5/Libkdepim/;${_IMPORT_PREFIX}/include/KF5/libkdepim;${_IMPORT_PREFIX}/include/KF5"
)

So I don't understand why it doesn't generate correct path for you.
Comment 3 Christophe Marin 2019-05-09 11:54:34 UTC
Does changing #include "libkdepim/progressmanager.h" to #include <libkdepim/progressmanager.h> help?
Comment 4 Christophe Marin 2019-05-09 12:16:46 UTC
A fix has to go in mailcommon/src/CMakeLists.txt however: if a libkdepim header is used by a mailcommon header, KF5::Libkdepim needs to be added in the 'PUBLIC' link targets of KF5MailCommon.
Comment 5 Jos van den Oever 2019-05-09 12:42:29 UTC
If you have proposed or applied patch for mailcommon/src/CMakeLists.txt, I can test it.
Comment 6 Christophe Marin 2019-05-14 11:18:13 UTC
Git commit cea29406f7a1c1cdca2cbbde19ac9e8008b28342 by Christophe Giboudeaux.
Committed on 14/05/2019 at 11:18.
Pushed by cgiboudeaux into branch 'Applications/19.04'.

Fix a potential build issue when building KMail

Summary:
some public mailcommon headers include libkdepim ones but the build system
currently doesn't look for this dependency.

Let's look for libkdepim for building mailcommon and explicitly add
KF5::Libkdepim to the 'PUBLIC' link targets to fix the
INTERFACE_LINK_LIBRARIES instead of relying on indirect dependencies.

Also fix a wrong #include statement.
FIXED-IN: 5.11.2

Reviewers: mlaurent, vandenoever

Reviewed By: mlaurent

Subscribers: kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D21205

M  +1    -0    CMakeLists.txt
M  +1    -0    KF5MailCommonConfig.cmake.in
M  +1    -0    src/CMakeLists.txt
M  +2    -1    src/job/backupjob.h

https://commits.kde.org/mailcommon/cea29406f7a1c1cdca2cbbde19ac9e8008b28342