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

Remove CMake < 3 CMP0042 workarounds #1040

Merged
merged 1 commit into from
Aug 11, 2024

Conversation

haampie
Copy link
Contributor

@haampie haampie commented Aug 7, 2024

Description

TL;DR: This deletes obsolete CMake code and improves upon #1002
by sticking to (sensible) CMake defaults, in accordance to the principle
of least astonishment ;)

CMake only sets install names on darwin to @rpath/<name> (which is
desired otherwise rpaths don't work at all) when CMP0042 is ON. That's
the default when CMake 3.0 or higher is required. And lapack requires it
already for years: as of v3.9.1 (8f004b3).

So, delete the old workarounds that effectively set CMP0042 to ON.

Further, delete the following three options that are redefinitions of
builtins and have values that are default anyways:

  • CMAKE_MACOSX_RPATH
  • CMAKE_SKIP_BUILD_RPATH
  • CMAKE_BUILD_WITH_INSTALL_RPATH

Lastly, lapack automatically sets CMAKE_INSTALL_RPATH_USE_LINK_PATH to
ON whenever installing to a non-system dir. The assumption is that
whenever you install something to a non-system dir, you need rpaths to
locate dependencies. But this is just an assumption which may or may
not hold. The downside of it is that the option can be annoying when
lapack is used as a sub-project as it affects a global CMake variable
(for example OpenBLAS uses lapack as a sub-project). Instead, let users
or packagers provide this on the command line if they really need it --
remove it from lapack as it's as helpful as it is harmful.

Checklist

  • The documentation has been updated.
  • If the PR solves a specific issue, it is set to be closed on merge.

CMake only sets install names on darwin to `@rpath/<name>` (which is
desired otherwise rpaths don't work at all) when CMP0042 is ON. That's
the default when CMake 3.0 or higher is required. And lapack requires it
already for years: as of v3.9.1
(8f004b3).

So, delete the old workarounds that effectively set CMP0042 to ON.

Further, delete the following three options that are redefinitions of
builtin with values that are builtin defaults:
- `CMAKE_MACOSX_RPATH`
- `CMAKE_SKIP_BUILD_RPATH`
- `CMAKE_BUILD_WITH_INSTALL_RPATH`

Lastly, lapack automatically sets `CMAKE_INSTALL_RPATH_USE_LINK_PATH` to
`ON` whenever installing to a non-system dir. The assumption is that
whenever you install something to a non-system dir, you need rpaths to
locate dependencies. But this is just an assumption which may or may
not hold. The downside of it is that the option can be annoying when
lapack is used as a sub-project as it affects a global CMake variable
(for example OpenBLAS uses lapack as a sub-project). Instead, let users
or packagers provide this on the command line if they really need it --
remove it from lapack as it's as helpful as it is harmful.
@haampie
Copy link
Contributor Author

haampie commented Aug 7, 2024

ping @langou / @ahnaf-tahmid-chowdhury (ref #1002)

Copy link
Contributor

@ahnaf-tahmid-chowdhury ahnaf-tahmid-chowdhury left a comment

Choose a reason for hiding this comment

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

I agree. Leveraging CMake's built-in capabilities whenever possible is generally a good approach.

@langou langou merged commit 9c0ef66 into Reference-LAPACK:master Aug 11, 2024
10 checks passed
@haampie haampie deleted the fix/rpath-once-again branch August 11, 2024 17:08
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.

3 participants