From: Ben Olson <matthew.olson@intel.com>
To: <dwarves@vger.kernel.org>
Cc: <alan.maguire@oracle.com>, <acme@kernel.org>
Subject: [PATCH dwarves] Respect CMAKE_INSTALL_LIBDIR
Date: Mon, 25 Nov 2024 09:51:51 -0600 [thread overview]
Message-ID: <Z0SdF3u92HMAu96S@bolson-desk> (raw)
This patch changes the `cmake` configuration to honor `CMAKE_INSTALL_LIBDIR`
and use `lib` by default so that installations match the conventional placement
of libraries. For example, it will now install `libdwarves.so` into
`/usr/local/lib` instead of `/usr/local` directly.
Signed-off-by: Brandon Kammerdiener <brandon.kammerdiener@intel.com>
Signed-off-by: Ben Olson <matthew.olson@intel.com>
---
This patch addresses this issue: https://github.com/acmel/dwarves/issues/48
CMakeLists.txt | 17 ++++-------------
README | 3 +--
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ca1bf2..b2c8057 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,18 +21,7 @@ else()
LINK_DIRECTORIES(${LIBBPF_LIBRARY_DIRS})
endif()
-# Try to parse this later, Helio just showed me a KDE4 example to support
-# x86-64 builds.
-# the following are directories where stuff will be installed to
-set(__LIB "" CACHE STRING "Define suffix of directory name (32/64)" )
-
-macro(_set_fancy _var _value _comment)
- if (NOT DEFINED ${_var})
- set(${_var} ${_value})
- else (NOT DEFINED ${_var})
- set(${_var} "${${_var}}" CACHE PATH "${_comment}")
- endif (NOT DEFINED ${_var})
-endmacro(_set_fancy)
+set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "libdir name")
# where to look first for cmake modules,
# before ${CMAKE_ROOT}/Modules/ is checked
@@ -84,7 +73,9 @@ 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()
-_set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${__LIB}" "libdir")
+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
diff --git a/README b/README
index f9aeef7..0627872 100644
--- a/README
+++ b/README
@@ -3,8 +3,7 @@ Build instructions:
1. install cmake
2. mkdir build
3. cd build
-4. cmake -D__LIB=lib ..
-5. make install
+4. make install
cmake Options:
-DBUILD_SHARED_LIBS
--
2.47.0
next reply other threads:[~2024-11-25 15:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 15:51 Ben Olson [this message]
2024-11-25 17:04 ` [PATCH dwarves] Respect CMAKE_INSTALL_LIBDIR Alan Maguire
2024-11-25 18:44 ` Olson, Matthew
2024-11-25 19:12 ` 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=Z0SdF3u92HMAu96S@bolson-desk \
--to=matthew.olson@intel.com \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=dwarves@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.