Skip to content

cmake: Use upstream helpers for the Config.cmake file - #124

Closed
LecrisUT wants to merge 3 commits into
Reference-ScaLAPACK:masterfrom
LecrisUT:cmake/refactor/cmake-config
Closed

LecrisUT wants to merge 3 commits into
Reference-ScaLAPACK:masterfrom
LecrisUT:cmake/refactor/cmake-config

Conversation

@LecrisUT

@LecrisUT LecrisUT commented Apr 2, 2025 •

Copy link
Copy Markdown
Contributor

First PR in the refactoring series. Use modern design for creating the Config.cmake file.

Depends-on: #123, #125
Fixes #109
(Mostly, the targets created and exported are still not visible, but I want to address that in another PR that focuses on readability, which would be the last in the series)

@LecrisUT
LecrisUT force-pushed the cmake/refactor/cmake-config branch 5 times, most recently from aaa2c4f to 5618e4b Compare April 3, 2025 12:51
@VictorEijkhout

Copy link
Copy Markdown

@LecrisUT I think my open ticket is waiting for this PR.

@LecrisUT

Copy link
Copy Markdown
Contributor Author

Yes, but we should get #125 to be easier to review, at the very least for me to re-review myself 😅

@LecrisUT
LecrisUT force-pushed the cmake/refactor/cmake-config branch from 5618e4b to 4446c06 Compare July 31, 2025 16:29
LecrisUT added 3 commits July 31, 2025 18:48
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
Signed-off-by: Cristian Le <git@lecris.dev>
@LecrisUT
LecrisUT force-pushed the cmake/refactor/cmake-config branch from 4446c06 to 3af8f08 Compare July 31, 2025 16:48

@LecrisUT LecrisUT left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@langou All good on my side for this one also

@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.17...4.0)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't remember why I set this one. But if anyone sees an issue with it just ping me. It might have been related to add_library(INTERFACE IMPORTED) or something else in the parts below.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does that mean 4.0 is the max? There is already a 4.1 release candiate.

@LecrisUT LecrisUT Jul 31, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, it means use policies up to version 4.0 as NEW. Read it as we have tested this part with "all cmakes" between <min>...<max>. The comment is about why I chose 3.17 as the minimum. For Config.cmake files, the minimum should be as low as possible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would recommend scalapack-config.cmake.in instead. Same as other related file name.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I thought that one was an outdated form of the other, but I checked the history again, and both forms were always supported since 3.0. Sure, no big preference on my side.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

scalapack-config.cmake.in allows users to use either find_package(scalapack) or find_package(SCALAPACK) or others, while scalapackConfig.cmake.in limit it to only find_package(scalapack). Usually I would prefer the former case 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, do you have a reference for this? The find_package logic is a piece of art, but I don't recall this behavior difference.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Aha I see it is in the help message, ok it rings a bell now. Was there a reason why I preferred the fixed naming convention? gtest and catch2 use the Config.cmake model, but I did see -config.cmake ones as well, but can't find a more recent popular project.

We would need to standardize the name though, so keeping -config.cmake makes sense until then

Comment thread CMakeLists.txt
RUNTIME DESTINATION Testing
)
install(TARGETS ${lib}
EXPORT scalapackTargets

@Growl1234 Growl1234 Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar here, and I think we should directly drop the macro as the TODO proposes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I lost the context on the naming convention here. I thought there was a part of the interface between install(TARGETS), install(EXPORT) and export(EXPORT) that used a *Targets as default, but I tried to find it again and nothing 🤷. Will have to check the generated files again as well, but otherwise np with the old name.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds a bit strange to me. It seems the build system isn't clean enough.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems the build system isn't clean enough.

For something that is more than 1 year old, probably 😁. But there were quite a few pitfalls around find_package logic that I was probably looking into in parallel at that time.

Comment thread CMakeLists.txt
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/scalapack
)
write_basic_package_version_file(
scalapackConfigVersion.cmake

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similar.

@Growl1234

Copy link
Copy Markdown
Contributor

I openend #170 towards an overall cleanup, and I'd be happy if you'd like to take a look :)

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.

what targets are published by cmake?

3 participants