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

Add alias target "Zycore::Zycore" #71

Merged
merged 1 commit into from
Jun 1, 2024
Merged

Add alias target "Zycore::Zycore" #71

merged 1 commit into from
Jun 1, 2024

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Jun 1, 2024

To offer the same public target regardless of zycore-c is used as a subproject or via find_package.
This should be complemented by Zydis linking "Zycore::Zycore".

(Noticed in reviewing a vcpkg port update.)

@flobernd
Copy link
Member

flobernd commented Jun 1, 2024

Hi @dg0yt, thanks for your contribution. Happy to merge this, but could you please explain me the why this is required? I'm not a CMake expert and don't quite see where the Zycore::Zycore comes from. Is that the way find_package exposes the lib, if no submodule is used?

@dg0yt
Copy link
Contributor Author

dg0yt commented Jun 1, 2024

Is that the way find_package exposes the lib, if no submodule is used?

Yes. The plain Zycore target doesn't exist after find_package(Zycore). The Zycore:: prefix is coming from the NAMESPACE given in the install(EXPORT ...) command.

why this is required?

Namespaces are not required, but here it is already added. And from the perspective of the consuming projects (Zydis), namespaces are a good thing: When CMake sees ::, it knows that the identifier shall be a target. It can create a proper error message at CMake generation time. (A::A doesn't exist. Did you forget find_package(A)?)") Plain names are considered "lib specs" if they are not targets, i.e. the linker will search for the name. If the user forgot find_package, she/he will see an error only at the end of the build, with no good diagnostics.

Basically, Zycore/Zydis form the text book example how it should be used.

@flobernd
Copy link
Member

flobernd commented Jun 1, 2024

Thanks a lot for the explanation @dg0yt 🙂 Merging this right now. Feel free to update the submodule in the Zydis PR so that we can merge this as well.

@flobernd flobernd merged commit fb69402 into zyantific:master Jun 1, 2024
24 checks passed
@dg0yt dg0yt deleted the patch-1 branch June 1, 2024 17:56
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