tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cmake radical proposal



On Fri, Oct 15, 2021 at 02:58:29AM +0000, David Holland wrote:
> On Mon, Oct 11, 2021 at 09:26:01PM -0400, Greg Troxel wrote:
>  > It seems that we are asking cmake not to add RPATH by the normal cmake
>  > mechanisms, and then passing in LDFLAGS with -Wl,-R/usr/pkg/lib.  I am
>  > not sure but this seems to clash with cmake's scheme for having tests
>  > use in-tree libs.
>  > 
>  > So I have a tentative belief that we should
>  > 
>  >   stop trying to pass -R
>  >   let cmake do what it wants with RPATH
>  > 
>  > Could anyone who understands or feels responsible for cmake comment on
>  > that?
> 
> My guess is that this will cause it to do nothing, as that's the Linux
> way, and then things won't work. This is what seems to happen in
> general for me outside pkgsrc, anyhow.
> 
> but I don't claim to understand cmake...

For a project I maintain using cmake, I have the following in my CMakeLists.txt:

if(NOT CMAKE_SYSTEM_NAME MATCHES Linux)
  set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
  set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif()

The if() clause could probably be improved, but it does not break on
at least Linux, macOS, NetBSD, and Windows.
 Thomas


Home | Main Index | Thread Index | Old Index