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

Fix absolute libdirpath builds #75

Closed

Conversation

StillerHarpo
Copy link

@StillerHarpo StillerHarpo commented Dec 17, 2022

This fixes builds where CMAKE_INSTALL_LIBDIR is absolute. This is the case on nixos (NixOS/nixpkgs#144170)

CMakeLists.txt Outdated
Comment on lines 211 to 219
if (IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_INSTALL_LIBDIR_PREFIX "${CMAKE_INSTALL_LIBDIR}")
else()
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig
set(CMAKE_INSTALL_LIBDIR_PREFIX "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()

install(FILES "${DCMTK_BINARY_DIR}/dcmtk.pc"
DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig
DESTINATION ${CMAKE_INSTALL_LIBDIR_PREFIX}/pkgconfig

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can simplify these two hunks to just:

-   DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig
+   DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig

CMake will ensure that CMAKE_INSTALL_LIBDIR gets prefixed as needed.

@bjornfor
Copy link

This fixes builds where CMAKE_INSTALL_FULL_LIBDIR is absolute.

I think you mean CMAKE_INSTALL_LIBDIR here, becasue CAKE_INSTALL_FULL_LIBDIR is always absolute.

@StillerHarpo
Copy link
Author

This fixes builds where CMAKE_INSTALL_FULL_LIBDIR is absolute.

I think you mean CMAKE_INSTALL_LIBDIR here, becasue CAKE_INSTALL_FULL_LIBDIR is always absolute.

Yes this is what I meant

Copy link

@bjornfor bjornfor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@bjornfor
Copy link

Nit: the PR message still mentions the wrong variable.

@michaelonken
Copy link
Member

michaelonken commented Jan 11, 2023

In theory, I could merge this, yes :-) I am not familiar with this part of the CMake toolchain files in DCMTK, I will check tomorrow with someone from the team.

Is the patch "clean" meanwhile (variable naming,..)? Are you quite sure it doesn't hurt on other OS?

Thank you for the contribution :)

@cfhammill
Copy link

Thanks @michaelonken, sorry for the terse message (which I deleted), I thought I was commenting on another PR. @StillerHarpo are you able to answer the above questions?

@michaelonken
Copy link
Member

After talking to the rest of the DCMTK yesterday: If the patch is confirmed (from your side) to be clean, I'm ready to merge it :)

@StillerHarpo
Copy link
Author

I build dcmtk with this patch on rasbian and it worked (only other os i have besides NixOS :))

The second hunch (in CMakeLists.txt) wasn't needed for nixos (it somehow got slipped in from experimenting). Im not sure if I should this hunk before merging. Im not very familiar with cmake. @bjornfor you seem to be more familiar with cmake. What do you think?

@bjornfor
Copy link

The second hunch (in CMakeLists.txt) wasn't needed for nixos (it somehow got slipped in from experimenting). Im not sure if I should this hunk before merging. Im not very familiar with cmake. @bjornfor you seem to be more familiar with cmake. What do you think?

I think the 2nd hunk is a good idea, ref #75 (comment). (Actually I'm surprised it worked without it on NixOS.)

@cfhammill
Copy link

@bjornfor it's not just NixOS, worked on ubuntu when installed with nixpkgs

@bjornfor
Copy link

@cfhammill: yes, I should have said nixpkgs, not nixos. Nixpkgs builds the same no matter what distro you run it on.

@StillerHarpo
Copy link
Author

@michaelonken I'm comfortable merging this

@michaelonken
Copy link
Member

I merged this into DCMTK's internal testing branch (04b0d6c). The commit will be visible on public master within the next days. Thank you for the patch :-)

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.

4 participants