Different settings of CMAKE_INSTALL_NAME_DIR & CMAKE_INSTALL_LIBDIR => broken libraries

Ryan Schmidt ryandesign at macports.org
Sat Mar 26 00:21:41 PDT 2016


On Mar 25, 2016, at 8:08 PM, Mojca Miklavec wrote:

> In Geant4 I'm using
>    -DCMAKE_INSTALL_LIBDIR=${prefix}/lib/Geant4/Geant${version}
> to allow side-by-side installation of multiple versions of the software.
> 
> However the latest release broke the behaviour and the libraries now
> point to a different path than where they are installed:
> 
>> otool -L /opt/local/lib/Geant4/Geant4.10.2/libG4FR.dylib
> /opt/local/lib/Geant4/Geant4.10.2/libG4FR.dylib:
>    /opt/local/lib/libG4FR.dylib
>   [...]
> 
> According to
>    http://bugzilla-geant4.kek.jp/show_bug.cgi?id=1848
> this might be a side effect of
>    -DCMAKE_INSTALL_NAME_DIR=/opt/local/lib
> which is automatically added by the cmake PortGroup.
> 
> I will do some further testing, but I would be interested in some
> deeper insight into how the system is *supposed to* work. The CMake
> documentation is not too verbose:
> https://cmake.org/cmake/help/v3.5/variable/CMAKE_INSTALL_NAME_DIR.html
> https://cmake.org/cmake/help/v3.5/module/GNUInstallDirs.html
> 
> (I cannot really decide whose fault the broken libraries are. I can
> imagine that I will have to remove or fix the
> -DCMAKE_INSTALL_NAME_DIR=... setting, but if there is something that
> could/should be improved in Geant4 for better
> support, I would like to know.)

As far as I know, yes, -DCMAKE_INSTALL_NAME_DIR=${prefix}/lib from the cmake portgroup would be the cause of this, and you should change this in your port if you want a different library install location. I admit I'm not familiar with -DCMAKE_INSTALL_LIBDIR. It's possible these two settings should always be the same? It's possible changes to the cmake portgroup are needed. Maybe it should set -DCMAKE_INSTALL_LIBDIR as well. Maybe the cmake portgroup should offer a variable for changing both of these cmake flags.



More information about the macports-dev mailing list