[cmake] Fix libneko.so loading error when installing to `/usr/local`
Fixes the error:
neko: error while loading shared libraries: libneko.so.2: cannot open shared object file: No such file or directory
which happens when installing to /usr/local/, the default location when building from source.
Reverted so this doesn't change the default value of RELOCATABLE, since that will have implications on nekotools boot. Also cleaned up the RPATH usage, so that during building there is no need to mess with LD_LIBRARY_PATH.
I can't really review this, but CI is green so I'll assume that it's good!
Do the tests still pass if RELOCATABLE is set to OFF?
Do the tests still pass if RELOCATABLE is set to OFF?
Yes, I ran the tests locally with RELOCATABLE=OFF without issues. During testing, with RELOCATABLE=OFF the build rpath is set by default to the full build path (e.g. /.../neko/build/bin), so the executables have no issues loading the libraries from there. Then during install the rpath is updated to the install rpath (/usr/local/lib).
With RELOCATABLE=ON, CMAKE_BUILD_WITH_INSTALL_RPATH is enabled so the same rpath is used for build and install. The rpath is now $ORIGIN:/usr/local/lib for both. This means that the tests still work, since at this stage $ORIGIN is equivalent to the build directory. After install the rpath remains the same so it remains relocatable, while still being able to load from /usr/local/lib.