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: improve default systemd unitdir #132

Closed
jengelh opened this issue Jan 5, 2023 · 1 comment
Closed

build: improve default systemd unitdir #132

jengelh opened this issue Jan 5, 2023 · 1 comment

Comments

@jengelh
Copy link

jengelh commented Jan 5, 2023

Some distributions have /usr/lib64 and accordingly pass -DCMAKE_INSTALL_LIBDIR:PATH=lib64 to cmake, but still, systemd is (always) fixed at /usr/lib/systemd.

function(find_systemd_unit_destination var)
    if(CMAKE_INSTALL_PREFIX MATCHES "^/usr/?$")
        if(EXISTS "/etc/debian_version")
            set(${var}
                "/lib/systemd/system"
                PARENT_SCOPE
            )
        else()
            set(${var}
                "${CMAKE_INSTALL_LIBDIR}/systemd/system"
                PARENT_SCOPE
            )
        endif()
    else()
        set(${var}
            "/etc/systemd/system"
            PARENT_SCOPE
        )
    endif()
endfunction()

The adequate way is to query pkgconfig: pkg-config systemd --variable=pkg-config systemd --variable=systemdsystemunitdir. That would also make the Debian check redundant.

@roehling
Copy link
Owner

roehling commented Jan 6, 2023

Oh, thanks, I did not know that!

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

No branches or pull requests

2 participants