Web lists-archives.com

Re: kdesrc-build: cmake should take local (instead of system-wide) cmake modules

On Wed, May 09, 2018 at 01:12:10PM +0200, 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 <codestruct@xxxxxxxxxx> 
> > 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.
> >>>> 
> >>>> 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?

This is all sort of odd.

Regarding the difficulty finding CMake packages, kdesrc-build sets
CMAKE_PREFIX_PATH already, based on your chosen install location (set by
'prefix' or the compatibility 'kdedir' option).

If you're installing to /usr or /usr/local then maybe that is why CMake
is finding system libraries?  Roman Gilg actually recently submitted a
patch to fix this (https://phabricator.kde.org/D12739), if that's what
the problem is.

> >>> 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.

There's no special behavior for kdesrc-build here (though there is a
cache, default .kdesrc-build-data in the same directory as your

However the CMake package to find when a CMake module config file is
loaded is based on the CMake paths when the module config file was
*installed*.  So all imported libraries would have be reinstalled to
fully fix the paths.

I've had these problems over the years and I've almost always found it
easier just to remove the CMake module config files entirely before
reinstalling to force it to be regenerated.

It may be easiest to remove the install directory completely and use
"kdesrc-build --refresh-build" to avoid interference from
previously-installed cruft.

 - Michael Pyne