Skip to content

Check if Zydis is the top-level project for better FetchContent support#459

Merged
athre0z merged 1 commit intozyantific:masterfrom
ZehMatt:fetchcontent-fix
Oct 14, 2023
Merged

Check if Zydis is the top-level project for better FetchContent support#459
athre0z merged 1 commit intozyantific:masterfrom
ZehMatt:fetchcontent-fix

Conversation

@ZehMatt
Copy link
Copy Markdown
Contributor

@ZehMatt ZehMatt commented Oct 12, 2023

This prevents targets such as examples, doxygen, etc. from being added when consumed via FetchContent

@ZehMatt ZehMatt force-pushed the fetchcontent-fix branch 2 times, most recently from c2c6a9a to 92818b1 Compare October 12, 2023 13:09
@flobernd flobernd requested a review from athre0z October 13, 2023 07:45
Copy link
Copy Markdown
Member

@flobernd flobernd left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks.

@athre0z
Copy link
Copy Markdown
Member

athre0z commented Oct 14, 2023

Hmm, not a fan of removing the options entirely if ZYDIS_ROOT_PROJECT isn't set. This will probably break vcpkgs build which itself uses CMake to describe package builds (so Zydis won't be top-level project).

I'd simply change the default values of those properties that are currently ON to ${ZYDIS_ROOT_PROJECT} instead. This sidesteps the issue and should provide the same desired outcome.

@flobernd
Copy link
Copy Markdown
Member

I suggested doing it this way to as well reduce option pollution while we are already on it.

Not sure about vcpkg, but that needs to be checked first. I'm fine with your approach as well, if removing the options might break some stuff.

Cmake itself is pretty forgiving with the options. Not declared ones are simply assumed to be OFF.

@ZehMatt
Copy link
Copy Markdown
Contributor Author

ZehMatt commented Oct 14, 2023

I've defaulted some of the options that were ON by default to ${ZYDIS_ROOT_PROJECT}, this gives us the same result but keeps the options alive and one can still override them with cmake command line using -D, so I think this is the most optimal approach.

@athre0z
Copy link
Copy Markdown
Member

athre0z commented Oct 14, 2023

I suggested doing it this way to as well reduce option pollution while we are already on it.

I don't think that our options are excessive. I far prefer having all the options visible over the user having to figure out why the hell some options magically disappeared once they include Zydis into their project.

Copy link
Copy Markdown
Member

@athre0z athre0z left a comment

Choose a reason for hiding this comment

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

LGTM!

@flobernd
Copy link
Copy Markdown
Member

Fine for me!

Maybe let's do the same change in Zycore and update the submodule as part of this PR before merging?

@athre0z
Copy link
Copy Markdown
Member

athre0z commented Oct 14, 2023

Zycore doesn't appear to have any default-ON options, so there shouldn't be any change required there. Or would you like to default-enable the tests there with a similar switch? That'd be fine with me.

@flobernd
Copy link
Copy Markdown
Member

Yeah it's inconsistent at the moment. Would be better to have the same logic in Zycore as well. But as the tests are currently OFF for Zycore, we can as well merge right away 🙂

@athre0z athre0z merged commit 70135b4 into zyantific:master Oct 14, 2023
@ZehMatt ZehMatt deleted the fetchcontent-fix branch October 14, 2023 19:32
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