-
Notifications
You must be signed in to change notification settings - Fork 565
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
Set LINK_LIBRARIES_ONLY_TARGETS=TRUE by default and verify Trilinos is clean with CMake 3.23+ #10081
Comments
This issue has had no activity for 365 days and is marked for closure. It will be closed after an additional 30 days of inactivity. |
@sebrowne, now that Trilinos is requiring CMake 3.23+, we can pull the trigger on this one. This will make the CMakeLists.txt files more robust and will be critical when refactoring to use raw library linking as listed in: |
So to clarify, this will turn "nonexistant" targets called with |
@sebrowne, yes. From LINK_LIBRARIES_ONLY_TARGETS:
Otherwise, if someone makes a mistake, you get a build-time error about a missing dependency (which is confusing for some people to figure out). That does not happen much with current TriBITS due to auto-linking between dependent package libraries but if Trilinos moves to manual linking (see TriBITSPub/TriBITS#569) then this will happen all of the time. |
I've already encountered this in my work on SIERRA's new build system, and like this behavior much better. Fully in favor. |
FYI: The recent refactoring of the TriBITS legacy TPL system that creates proper CMake IMPORTED targets will allow Trilinos (and TriBITS) to set |
@sebrowne, @ccober6, and @jwillenbring, this is another one that should be turned on for Trilinos 15.0. |
We'll get on it immediately (I'll write a small story and have the team take care of it prior to the release). Thanks for circling back! |
As per trilinos#10081. User Support Ticket(s) or Story Referenced: TRILFRAME-601
@sebrowne, FYI, I had to revert the merge of the PR: with the revert PR: because it was breaking the installed First, we need to beef up the test
and: Trilinos/packages/TrilinosInstallTests/find_package_Trilinos/CMakeLists.txt Lines 1 to 11 in b3965b6
to try to expose this failure. I am surprised that test passed in all of the PR builds shown here before it was merged. We should try adding a dummy executable as part of that dummy CMake project find_package_Trilinos and linking in the Trilinos libraries and see if it triggers that error reported in #12371. As for setting Option-1: Set the property Option-2: Create a new Trilinos TriBITS TPL Option-1 involves less code but it seems like kind of a hack. Option-2 involves a little more overhead (in a new file NOTE: One option not to try to export the created imported target because CMake does not support that :-( |
Add a dummy executable that depends on all of the built Trilinos libraries to attempt to exercise some more failure cases. Specifically, this is to try and make visible the failure where imported toolchain libraries (e.g. libm) will not work in downstream builds due to incomplete install logic. User Support Ticket(s) or Story Referenced: TRILFRAME-601 trilinos#10081
@bartlettroscoe I added that case to the test and tested it, it does work and catch the issue. |
Add a dummy executable that depends on all of the built Trilinos libraries to attempt to exercise some more failure cases. Specifically, this is to try and make visible the failure where imported toolchain libraries (e.g. libm) will not work in downstream builds due to incomplete install logic. User Support Ticket(s) or Story Referenced: TRILFRAME-601 trilinos#10081
For now, we can put this back into the backlog since this is not worth fixing for now. If we get Trilinos internal packages using raw CMake, then we may want to try harder to turn this on and address the issue with the |
As discussed in TriBITSPub/TriBITS#299 (comment), CMake 3.23 will learn the target property
LINK_LIBRARIES_ONLY_TARGETS
that if set toTRUE
, will help catch errors when linking against undefined targets. With the updated TriBITS, raw library names for external packages/TPLs are no longer directly passed totarget_link_libraries()
and therefore, unless people are directly callingtarget_link_libraries()
against raw lib names in Trilinos CMakeLists.txt files, we should be able to setLINK_LIBRARIES_ONLY_TARGETS
to true with Trilinos.But before I felt confident about that, Trilinos would need to upgrade its minimum CMake version to CMake 3.23+ and all of the Trilinos PR and ATDM Trilinos builds would need to be tested with this option enabled with the upgraded CMake.
The text was updated successfully, but these errors were encountered: