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

Create imported targets in DARTFind*.cmake instead of Find*.cmake #1222

Merged
merged 8 commits into from
Jan 11, 2019

Conversation

mxgrey
Copy link
Member

@mxgrey mxgrey commented Jan 11, 2019

This attempts to fix the issue reported in the thread of #1209

@jslee02 jslee02 added this to the DART 6.7.1 milestone Jan 11, 2019
Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

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

Looks good to me! Let's add an item for this change in the changelog under DART 6.7.1.

@mxgrey
Copy link
Member Author

mxgrey commented Jan 11, 2019

@jslee02 I'm looking over the cmake scripts for finding packages, and I'm not clear on one thing: What happens when the dependency of a component is missing? For example, let's say I install libdart with libdart-utils which depends on libtinyxml2, but later I forcibly delete libtinxyml2. Then I call find_package(DART REQUIRED COMPONENT utils). Ideally cmake should recognize that tinxyml2 is no longer available and then make the configuration fail.

I think that'll work fine for core dependencies, because we use find_package(... REQUIRED) on those, but the components don't use REQUIRED in their DARTFind*.cmake files, so I don't think this situation will be caught.

Please let me know if I'm overlooking something. In the meantime I'll see if I can find a minimally invasive way to make the config-file work as desired.

@jslee02
Copy link
Member

jslee02 commented Jan 11, 2019

I also think the current script wouldn't catch the case, which I believe most of the build scripts wouldn't do either (because the system has been forcibly changed from when it was built). But it sounds good to have a logic to catch the case.

@jslee02
Copy link
Member

jslee02 commented Jan 11, 2019

One possible solution would be:

  • Change all the current DARTFind<package>.cmake files into macros and put it in one file (e.g., DARTFindPackages.cmake)
  • Make the macros to have an option whether finding the package required or not
  • Find packages with or without required option when DART is built depending on whether the package is options
  • Find packages with required option in DARTConfig.cmake

@mxgrey
Copy link
Member Author

mxgrey commented Jan 11, 2019

CMake config-files are encouraged to use find_dependency() which will pass along the REQUIRED and QUIET properties from the config-file or find-module that uses it. When a required dependency isn't found, the configuration will fail. Ideally that's the kind of behavior we should aim for.

Unfortunately find_dependency(~) only helps in very narrow circumstances, and I don't think it'll help us out much here. I have some ideas about a solution, though. I'll open a separate PR for that, though, since it's mostly orthogonal to this issue.

@mxgrey
Copy link
Member Author

mxgrey commented Jan 11, 2019

I'm thinking about using the dart_*Component.cmake files to handle the REQUIRED behavior. It looks like those files are automatically generated, so it should be pretty straightforward to put the behavior into them. I just need to find how those files get created.

@jslee02
Copy link
Member

jslee02 commented Jan 11, 2019

Unfortunately find_dependency(~) only helps in very narrow circumstances, and I don't think it'll help us out much here.

Yeah, AFAIK, find_dependency() does not support COMPONENTS or MODULE until 3.8.0.

I'll open a separate PR for that, though, since it's mostly orthogonal to this issue.

👍

@jslee02
Copy link
Member

jslee02 commented Jan 11, 2019

I just need to find how those files get created.

Those files are generated by these lines in Components.cmake.

Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jslee02 jslee02 merged commit ce185b7 into release-6.7 Jan 11, 2019
@jslee02 jslee02 deleted the rename_find_modules branch January 11, 2019 22:28
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.

2 participants