public inbox for dwarves@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Paul Menzel <pmenzel@molgen.mpg.de>, dwarves@vger.kernel.org
Cc: Ben Olson <matthew.olson@intel.com>,
	Brandon Kammerdiener <brandon.kammerdiener@intel.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Ben Olson <matthew.olson@intel.com>
Subject: Re: [PATCH] CMakeLists.txt: Remove custom `LIB_INSTALL_DIR` handling
Date: Fri, 23 May 2025 12:05:55 +0100	[thread overview]
Message-ID: <5b737d77-6db1-4e63-91dc-68b48e5367bb@oracle.com> (raw)
In-Reply-To: <20250420064220.81114-2-pmenzel@molgen.mpg.de>

On 20/04/2025 07:42, Paul Menzel wrote:
> There is no need to explicitly set `LIB_INSTALL_DIR`, as CMake’s module
> GNUInstallDirs sets it itself from `CMAKE_INSTALL_LIBDIR`, and takes
> care of everything, so the line below is enough.
> 
>     cmake -DLIBBPF_EMBEDDED=OFF -DCMAKE_INSTALL_LIBDIR=lib ..
> 
> Note, it’s common to set it to a relative path, but absolute paths are
> allowed too.
> 
>     cmake -DLIBBPF_EMBEDDED=OFF -DCMAKE_INSTALL_LIBDIR=/opt/usr/lib64 ..
> 
> From the [CMake documentation][1]:
> 
>> CMAKE_INSTALL_<dir>
>>
>> Destination for files of a given type. This value may be passed to the
>> DESTINATION options of install() commands for the corresponding file type.
>> It should be a path relative to the installation prefix so that it can be
>> converted to an absolute path in a relocatable way.
>>
>> While absolute paths are allowed, they are not recommended as they do not
>> work with the cmake --install command's --prefix option, or with the cpack
>> installer generators. In particular, there is no need to make paths
>> absolute by prepending CMAKE_INSTALL_PREFIX; this prefix is used by
>> default if the DESTINATION is a relative path.
> 
> So, remove the custom handling from `CMakeLists.txt`. Also, update
> `README` and mention the option.
> 
> [1]: https://cmake.org/cmake/help/v3.31/module/GNUInstallDirs.html
> 
> Link: https://lore.kernel.org/all/9fb4f7ba-0de1-4f75-9bd2-66212ca8cd86@molgen.mpg.de/
> Fixes: a2abd9482162 ("CMakeList.txt: Respect CMAKE_INSTALL_LIBDIR")
> Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>

Sorry Paul, left you hanging here. Above seems reasonable - any issues
with this from anyone (I've cc'ed Ben who made changes in this area before)?

If not I'll apply early next week. Thanks!

Alan

> ---
>  CMakeLists.txt | 5 -----
>  README         | 4 ++++
>  2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index eb87300..844ab61 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -23,7 +23,6 @@ endif()
>  
>  # Use the standard library installation directory
>  include(GNUInstallDirs)
> -set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "libdir name")
>  
>  # where to look first for cmake modules,
>  # before ${CMAKE_ROOT}/Modules/ is checked
> @@ -75,10 +74,6 @@ if(NOT LIBBPF_FOUND AND NOT EXISTS "${PROJECT_SOURCE_DIR}/lib/bpf/src/btf.h")
>  	message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
>  endif()
>  
> -if (NOT DEFINED LIB_INSTALL_DIR)
> -    set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
> -endif()
> -
>  # libbpf uses reallocarray, which is not available in all versions of glibc
>  # libbpf's include/tools/libc_compat.h provides implementation, but needs
>  # COMPACT_NEED_REALLOCARRAY to be set
> diff --git a/README b/README
> index a938266..fb92d68 100644
> --- a/README
> +++ b/README
> @@ -18,6 +18,10 @@ cmake Options:
>      Default is to install to /usr/local, use -DCMAKE_INSTALL_PREFIX=
>      when invoking cmake to specify another install location.
>  
> +  -DCMAKE_INSTALL_LIBDIR
> +    Default is to install to lib or lib64, use -DCMAKE_INSTALL_LIBDIR=
> +    when invoking cmake to specify another install location.
> +
>  You may need to update the libbpf git submodule:
>  
>  git submodule update --init --recursive


  reply	other threads:[~2025-05-23 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-20  6:42 [PATCH] CMakeLists.txt: Remove custom `LIB_INSTALL_DIR` handling Paul Menzel
2025-05-23 11:05 ` Alan Maguire [this message]
2025-05-30 12:51 ` Alan Maguire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b737d77-6db1-4e63-91dc-68b48e5367bb@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=acme@redhat.com \
    --cc=brandon.kammerdiener@intel.com \
    --cc=dwarves@vger.kernel.org \
    --cc=matthew.olson@intel.com \
    --cc=pmenzel@molgen.mpg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox