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

Allow installing binaries to subdirectory while keeping CMake package scripts in the same place #1008

Closed
lepus2589 opened this issue Apr 11, 2024 · 1 comment · Fixed by #1009

Comments

@lepus2589
Copy link
Contributor

Currently, both compiled binaries and CMake package scripts are installed to the same location using the CMake variable ${CMAKE_INSTALL_LIBDIR} (CMake scripts go to the subdirectory cmake). If you want to install the binaries to a subdirectory (e. g. /usr/local/lib/lapack to avoid conflicts with other distributions), you have to modify this variable from the command line. Unfortunately, because the CMake scripts also use this variable, their install location changes to /usr/local/lib/lapack/cmake. This is a non-standard location that will not be automatically picked up by CMake.

Proposed new feature: Please support installing the binaries to a subdirectory of ${CMAKE_INSTALL_LIBDIR} while keeping the CMake package scripts in the same, default-discoverable location.

Possible solutions: Introduce project variables for the binary and/or the CMake script install location, that can be individually overridden by the consumer.

Personally, I think it's a bad idea to force the user to override a variable that is provided by the CMake module GNUInstallDirs, if they want to customize the install location. This can have unforeseen consequences.

Thus, I would propose to change this macro to not use ${CMAKE_INSTALL_LIBDIR} and ${CMAKE_INSTALL_BINDIR} directly. Either, one could introduce two new project options containing the binary install paths relative to the install prefix, defaulting to the current values. Or one could introduce a $LAPACK_BINARY_PATH_SUFFIX project option (PATH SUFFIX is the wording CMake uses in their documentation of find_package()) defaulting to the empty string and append that to the current values.

I'm happy to provide a PR, but I'll wait for feedback first.

@langou
Copy link
Contributor

langou commented Apr 12, 2024

Hi @lepus2589, I do not have a strong understanding of all this, so if no one expresses a negative opinion, I'll be happy to review, approve and merge your PR. Overall, this sounds reasonable, and this sounds great, so thanks a lot for making the suggestion and volunteering for a PR. Much appreciated. So if no one expresses concerns, then, yes please by all means, we would be happy to review a PR on this issue from you. If someone expresses concerns, we can discuss some more. Julien.

@lepus2589 lepus2589 changed the title Allow installing of binaries to subdirectory while keeping CMake package scripts in the same place Allow installing binaries to subdirectory while keeping CMake package scripts in the same place Apr 17, 2024
langou added a commit that referenced this issue Apr 17, 2024
…ries-to-subdirectory-while-keeping-cmake-package-scripts-in-the-same-place

#1008 Allow installing binaries to subdirectory while keeping CMake package scripts in the same place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants