Bug 402902

Summary: libxkbfile specified as optional, but CMake still fails if it is not present
Product: [Applications] ktouch Reporter: t.schmittlauch
Component: generalAssignee: Sebastian Gottfried <sebastian.gottfried>
Status: RESOLVED FIXED    
Severity: minor CC: asturm
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 19.08.0
Attachments: build.log

Description t.schmittlauch 2019-01-05 19:15:43 UTC
While packaging ktouch for NixOS, I found out that libxkbfile doesn't seem to be as optional as described: Although the README [1] specifies libxkbfile as optional, when libxkbfile is not provided to the build environment cmake fails:

```
builder for '/nix/store/ljm4ikyz4c785jf9qxk4q2lpbdqvarmh-ktouch-18.12.0.drv' failed with exit code 1; last 10 log lines:
     used as include directory in directory /build/ktouch-18.12.0/src
     used as include directory in directory /build/ktouch-18.12.0/src
     used as include directory in directory /build/ktouch-18.12.0/src
     used as include directory in directory /build/ktouch-18.12.0/src
     used as include directory in directory /build/ktouch-18.12.0/src
  X11_Xkbfile_LIB (ADVANCED)
      linked by target "ktouch" in directory /build/ktouch-18.12.0/src
  
  -- Configuring incomplete, errors occurred!
```

I could narrow it down to the call `find_package(X11)` [2], which invokes the CMake module `FindX11` and thus also searches for libxkbfile, failing if it is not found.

Thus it'd be interesting whether the `find_package(X11)` could be marked optional. Otherwise the README needs some adjustments.

[1] https://cgit.kde.org/ktouch.git/tree/README.md
[2] https://cgit.kde.org/ktouch.git/tree/src/CMakeLists.txt#n7
Comment 1 Andreas Sturmlechner 2019-07-07 21:11:02 UTC
Created attachment 121372 [details]
build.log

Even if you fix cmake to get beyond that point, it will later fail to build when actually going through the else(KTOUCH_BUILD_WITH_X11) path.

Attaching MAKEOPTS=-j1 build.log with libX11 disabled (and patch from https://phabricator.kde.org/D22313 applied)
Comment 2 Sebastian Gottfried 2019-07-10 19:47:08 UTC
Git commit 4cba35d316e0f4372283a9751700b573280763b0 by Sebastian Gottfried.
Committed on 10/07/2019 at 19:38.
Pushed by gottfried into branch 'master'.

Fix Build Without X11 Deps

This was impossible for two reasons:

 * Not all of the required libs were properly checked by the CMake
   files. This enabled the X11 features even if not all libs were
   present.

 * The X11-less code path suffered from one regression from the port
   to KF5.
FIXED-IN: 19.08.0

M  +1    -0    CMakeLists.txt
M  +8    -3    README.md
M  +10   -14   src/CMakeLists.txt
M  +1    -1    src/ktouchcontext.cpp

https://commits.kde.org/ktouch/4cba35d316e0f4372283a9751700b573280763b0