Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Linux lib64 packaging #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guoyunhe
Copy link

Most Linux systems are 64bit and have libraries in /usr/lib64. Packaging tools automatically pass some parameters to cmake. CMAKE_INSTALL_LIBDIR is used to specify where to install library.

@musicinmybrain
Copy link
Contributor

I haven’t tested this yet, and my CMake-fu is not strong, but Fedora Linux’s %cmake macro does not pass CMAKE_INSTALL_LIBDIR. Instead, this variable normally comes from including the GNUInstallDirs module.

@musicinmybrain
Copy link
Contributor

I tried this:

From 10a8c31a11dd1f6a8da24b4490aa96a482c0e316 Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <[email protected]>
Date: Sun, 16 Jul 2023 09:23:05 -0400
Subject: [PATCH] Use GNUInstallDirs

Fixes incorrect installation of libraries into /usr/lib instead of
/usr/lib64 on Linux distributions and architectures that use multilib.
---
 c4Project.cmake | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/c4Project.cmake b/c4Project.cmake
index e78525a..7a57c1b 100644
--- a/c4Project.cmake
+++ b/c4Project.cmake
@@ -24,6 +24,7 @@ include(PrintVar)
 include(c4CatSources)
 include(c4Doxygen)
 include(PatchUtils)
+include(GNUInstallDirs)
 
 
 #------------------------------------------------------------------------------
@@ -2653,12 +2654,12 @@ endfunction()
 
 
 macro(_c4_setup_install_vars)
-    set(_RUNTIME_INSTALL_DIR   bin/)
-    set(_ARCHIVE_INSTALL_DIR   lib/)
-    set(_LIBRARY_INSTALL_DIR   lib/) # TODO on Windows, ARCHIVE and LIBRARY dirs must be different to prevent name clashes
-    set(_INCLUDE_INSTALL_DIR   include/)
+    set(_RUNTIME_INSTALL_DIR   ${CMAKE_INSTALL_BINDIR}/)
+    set(_ARCHIVE_INSTALL_DIR   ${CMAKE_INSTALL_LIBDIR}/)
+    set(_LIBRARY_INSTALL_DIR   ${CMAKE_INSTALL_LIBDIR}/) # TODO on Windows, ARCHIVE and LIBRARY dirs must be different to prevent name clashes
+    set(_INCLUDE_INSTALL_DIR   ${CMAKE_INSTALL_INCLUDEDIR}/)
     set(_OBJECTS_INSTALL_DIR   obj/)
-    set(_SYSCONFIG_INSTALL_DIR etc/${_c4_lcprefix}/)
+    set(_SYSCONFIG_INSTALL_DIR ${CMAKE_INSTALL_SYSCONFDIR}/${_c4_lcprefix}/)
 endmacro()
 
 
-- 
2.41.0

but it did not seem to have the desired effect. It would be really nice to have this fixed upstream so that distribution packagers don’t have to move installed libraries and hack around on the generated .cmake files (https://bugzilla.redhat.com/show_bug.cgi?id=2223194).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants