Skip to content

build(cmake): export and install zyan_* functions#33

Merged
athre0z merged 1 commit intozyantific:masterfrom
Tachi107:build-cmake-export-functions
Oct 16, 2021
Merged

build(cmake): export and install zyan_* functions#33
athre0z merged 1 commit intozyantific:masterfrom
Tachi107:build-cmake-export-functions

Conversation

@Tachi107
Copy link
Copy Markdown
Contributor

@Tachi107 Tachi107 commented Oct 8, 2021

Now when calling find_package(Zycore) users will be able to use the zyan functions.

This would make it possible to use find_package(Zycore) to find and use the system Zycore library in Zydis. Before this change, if instead of compiling Zycore with add_subdirectory() you used find_package(Zycore), the build failed, because functions like zyan_set_common_flags() were not imported.

I also removed ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} etc from install(TARGETS ...) because they are already set by default

Tachi107 added a commit to Tachi107/zydis that referenced this pull request Oct 8, 2021
Tachi107 added a commit to Tachi107/zydis that referenced this pull request Oct 9, 2021
@athre0z athre0z added A-build Area: Build system C-enhancement Category: Enhancement of existing features P-medium Priority: Medium labels Oct 9, 2021
@athre0z athre0z self-assigned this Oct 9, 2021
@abouvier
Copy link
Copy Markdown
Contributor

I also removed ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} etc from install(TARGETS ...) because they are already set by default

You can remove the DESTINATION but you need to keep the ARCHIVE keyword, like this:

install(TARGETS "Zycore" EXPORT "zycore-targets" ARCHIVE LIBRARY RUNTIME)

@Tachi107
Copy link
Copy Markdown
Contributor Author

You can remove the DESTINATION but you need to keep the ARCHIVE keyword

I'm not sure about that. From the docs: For each of these arguments given, the arguments following them only apply to the target or file type specified in the argument. If none is given, the installation properties apply to all target types. If only one is given then only targets of that type will be installed

If I understand this correctly, they are only used to define properties of specific types of targets and limit the types that can be installed. Since here we don't have to define type-specific properties, specifying ARCHIVE etc is not needed.

Also, diff reports no difference between the zycore-targets.cmake files generated with and without the type arguments

@abouvier
Copy link
Copy Markdown
Contributor

Oops, I thought the keyword allowed you to choose which files to install.

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.

Thanks, looks good in general! Left one minor comment to discuss.

Now when calling find_package(Zycore) users will be able to use the zyan
functions.

This would make it possible to use find_package(Zycore) to find and
use the system Zycore library in Zydis. Before this change, if instead
of compiling Zycore with add_subdirectory() you
used find_package(Zycore),
the build failed, because functions like zyan_set_common_flags()
were not imported.
@Tachi107 Tachi107 force-pushed the build-cmake-export-functions branch from ec92dfd to 464f804 Compare October 16, 2021 16:09
@athre0z athre0z merged commit 767719d into zyantific:master Oct 16, 2021
@Tachi107 Tachi107 deleted the build-cmake-export-functions branch October 16, 2021 16:13
Tachi107 added a commit to Tachi107/zydis that referenced this pull request Oct 17, 2021
athre0z pushed a commit to zyantific/zydis that referenced this pull request Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-build Area: Build system C-enhancement Category: Enhancement of existing features P-medium Priority: Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants