xxHash
xxHash copied to clipboard
Fix double prefix when building with cmake
@Cyan4973 ping
@ilya-fedin, I'm sorry about these annoying errors! #736 will fix this issue.
I'm trying to understand what was the objective of this PR.
The title mentions "Fix double prefix when building with cmake",
which implies there's an issue when building with cmake
.
It's probably not a trivial scenario, since I could not detect any issue from basic cmake
tests.
If that's the case, I would expect it should be possible to create a test case that reproduces this issue. Such test case could then be integrated into CI.
Looking at the PR's content, it appears focused on pkg-config generation.
More specifically includedir
and libdir
are now set entirely from the build system, either make
or cmake
, instead of being derived from prefix
within the pkgconfig file. The new design seems superficially similar to the original one, but I presume it differs in subtle ways, in order to fix some edge cases that were not properly covered.
And since the new design is also a bit more complex, which is a cost to maintenance, I would like to understand precisely what it does better.
Note : I see that one test was failing, but my understanding is that the problem was on the test side, not the PR. We can ignore it.
Try to build xxHash with the following cmake arguments:
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_INCLUDEDIR=/usr/include -DCMAKE_INSTALL_LIBDIR=/usr/lib
This is valid for cmake but xxHash's build scripts generate pkg-config file in a way it gets /usr/usr/include
, /usr/usr/lib
OK !
Following the proposed test,
I get the following content in libxxhash.pc
:
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}//usr/include
libdir=${exec_prefix}//usr/lib
which is obviously incorrect, and will lead to duplicated prefix /usr
.
In contrast, after your patch, the content of libxxhash.pc
becomes :
prefix=/usr
exec_prefix=${prefix}
includedir=/usr/include
libdir=/usr/lib
It's probably worth making a test from this example.
Sorry, but I don't have that much interest to create a test. If this is required to get the PR merged, I'd just close it and let someone else to do the work.
Don't worry, I'm taking care of it (#845).