On 09.05.2018 13:12, gregor.mi.sw wrote:
Am 09.05.2018 08:19 schrieb Ben Cooksley:
On Wed, May 9, 2018 at 9:28 AM, gregor.mi.sw <codestr...@posteo.org> wrote:
On 08.05.2018 23:15, Milian Wolff wrote:
On Dienstag, 8. Mai 2018 22:40:39 CEST gregor.mi.sw wrote:
Hello,
I have a question regarding kdesrc-build and CMake.
I setup the build environment variables and ran kdesrc-build and got a
compiler error kinfocenter.
I investigated
/home/gregor/kde/src/build/kde/workspace/kinfocenter/CMakeCache.txt and
found the following lines
//The directory containing a CMake configuration file for
KF5Service.
KF5Service_DIR:PATH=/usr/lib64/cmake/KF5Service
//The directory containing a CMake configuration file for KF5Solid.
KF5Solid_DIR:PATH=/usr/lib64/cmake/KF5Solid
//The directory containing a CMake configuration file for
KF5Wayland.
KF5Wayland_DIR:PATH=/usr/lib64/cmake/KF5Wayland
The directories of the needed KF5 frameworks point to the system wide
installed ones.
I removed the system-wide devel package for solid (because it caused the
compiler error) and ran kdesrc-build again:
//The directory containing a CMake configuration file for
KF5Service.
KF5Service_DIR:PATH=/usr/lib64/cmake/KF5Service
//The directory containing a CMake configuration file for KF5Solid.
KF5Solid_DIR:PATH=/home/gregor/kde/usr/lib64/cmake/KF5Solid
//The directory containing a CMake configuration file for
KF5Wayland.
KF5Wayland_DIR:PATH=/usr/lib64/cmake/KF5Wayland
Now it shows the correct (local) path for solid (but not the other ones).
Is
there an environment variable or something I have to set to tell Cmake to
always look for local modules first?
Try CMAKE_PREFIX_PATH. See e.g. this old blog post on the matter:
https://blogs.kde.org/2008/12/12/how-get-cmake-find-what-you-want-it
Thanks for the hint. The variable was already set:
CMAKE_PREFIX_PATH=/home/gregor/kde/usr:
In the blog post, it is said, that CMAKE_PREFIX_PATH is searched _first_. I
find it strange that I had to uninstall the system-wide devel package in
order to have cmake pick up the library in /home/gregor/kde/usr. And for the
other libraries it still uses /usr. Any idea how to investigate this
further?
If you have previously run CMake without setting CMAKE_PREFIX_PATH you
will need to remove your build directory first, otherwise it will
reuse modules it has already found.
Hello Ben, I already removed the build dir (forgot to mention that). I assume that it should be
sufficient to delete the build dir of the application that should be configured
(/home/gregor/kde/src/build/kde/workspace/kinfocenter/) and not also those of the imported libraries
(KF5Service, KF5Solid, KF5Wayland etc.). I wonder if there is maybe an additional (global) cmake
cache or a special behaviour of kdesrc-build.
Gregor
Today, I opened the CMakeCache.txt again in Kate, deleted it and ran
$ cmake /home/gregor/kde/src/kde/workspace/kinfocenter/
with CMAKE_PREFIX_PATH set to "/home/gregor/kde/usr:"
With Kate I made a diff between the previous (which did not work) and current
(now works) file:
https://ibb.co/bOznrJ (left: old/not working, right: new/compiles)
Noteworthy differences:
OLD (wrong paths) NEW (correct paths)
CMAKE_INSTALL_PREFIX:PATH=/home/gregor/kde/usr
CMAKE_INSTALL_PREFIX:PATH=/usr/local
CMAKE_PREFIX_PATH:UNINITIALIZED=/usr nothing
ECM_DIR:PATH=/usr/share/ECM/cmake
ECM_DIR:PATH=/home/gregor/kde/usr/share/ECM/cmake
The interesting thing is that
1. Although the CMAKE_PREFIX_PATH was set as environment variable, it is not explicitly mentioned in
the CMakeCache.txt but the ECM_DIR:PATH is now correct.
2. The CMAKE_INSTALL_PREFIX in the new version points to /usr/local which I assume is normally set
by kdesrc-build to the correct location.
So the manual cmake works.
Then, I tried again with kdesrc-build and although CMAKE_PREFIX_PATH was still exported correctly
(/home/gregor/kde/usr), in the CMakeCache.txt there is the lines
//No help, variable specified on the command line.
CMAKE_PREFIX_PATH:UNINITIALIZED=/usr
and
ECM_DIR:PATH=/usr/share/ECM/cmake
which I assume makes the KF5 framework modules to be found in the wrong
(system) directory.
I would be interested how the CMakeCache.txt of a healthy kdesrc-build would
look like.
Gregor