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

build: Tell cmake to set 'rpath' #531

Merged
merged 2 commits into from
Apr 27, 2024

Commits on Mar 11, 2024

  1. build: Remove unnecessary enabling of target property: MACOSX_RPATH

    According to CMake's documentation, MACOSX_RPATH is on already:
    
      https://cmake.org/cmake/help/latest/policy/CMP0042.html
    
    Specifically:
    
      CMake 3.0 and later prefer this property to be ON by default.
      [This policy] may be set by cmake_policy() or cmake_minimum_required().
      If it is not set, CMake warns, and uses OLD behavior.
    
    Well, the top-level 'CMakeLists.txt' already sets the minimum version:
    
      cmake_minimum_required(VERSION 3.7)
    
    Therefore, it is unnecessary to enable it explicitly.
    mfwitten committed Mar 11, 2024
    Configuration menu
    Copy the full SHA
    b4544e1 View commit details
    Browse the repository at this point in the history

Commits on Apr 25, 2024

  1. build: Tell cmake to set 'rpath' so the installed 'cmark' can find 'l…

    …ibcmark.so'
    
    Before this commit, the 'cmark' executable didn't inform the
    dynamic linker where to look for the 'libcmark' shared object;
    this becomes an irritation when libcmark is installed in an
    unorthodox location:
    
      $ ldd /path/to/installed/files/bin/cmark
              linux-gate.so.1 (0xb7ed7000)
              libcmark.so.0.31.0 => not found
              libc.so.6 => /usr/lib/libc.so.6 (0xb7cf3000)
              /lib/ld-linux.so.2 => /usr/lib/ld-linux.so.2 (0xb7ed8000)
    
    Because of this commit, the cmark executable's 'rpath' setting
    (or equivalent) is set upon installation, thereby providing the
    required search directory:
    
      $ ldd /path/to/installed/files/bin/cmark
              linux-gate.so.1 (0xb7ef2000)
              libcmark.so.0.31.0 => /path/to/installed/files/lib/libcmark.so.0.31.0 (0xb7e95000)
              libc.so.6 => /usr/lib/libc.so.6 (0xb7cbc000)
              /lib/ld-linux.so.2 => /usr/lib/ld-linux.so.2 (0xb7ef3000)
    
    There is some intelligence behind whether rpath is set at all:
    
      * If 'CMAKE_INSTALL_RPATH' is set, then it is used; this
        allows the user to set a single, overriding value in
        the expected way.
    
      * Otherwise, the base case rpath is determined by the following:
    
          "${CMAKE_INSTALL_FULL_LIBDIR}"
    
        If that path is a standard location, then the base case rpath
        is the empty string; otherwise, the base case rpath is that
        path.
    
      * The cmark executable's rpath is set to the base case rpath.
    
      * Currently, libcmark's rpath is set to the empty string.
    
      * In addition, cmake has been instructed to add to each target's
        rpath any directories that it thinks might contain potential
        dependencies from outside the project; most of the time, there
        will be none, and so nothing will be added.
    
    Of course, this will only help on a system that supports an rpath
    feature known to cmake; for example, Windows has no such feature,
    and so all of this will presumably be ignored when building under
    that system.
    mfwitten committed Apr 25, 2024
    Configuration menu
    Copy the full SHA
    10e06da View commit details
    Browse the repository at this point in the history