vcpkg/ports/polyhook2/fix-dep.patch
Summpot 0a7d997308
[polyhook2] Update to 2024-02-08 (#37866)
<!-- If your PR fixes issues, please note that here by adding "Fixes
#NNNNNN." for each fixed issue on separate lines. -->

<!-- If you are still working on the PR, open it as a Draft:
https://github.blog/2019-02-14-introducing-draft-pull-requests/. -->


- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [x] The "supports" clause reflects platforms that may be fixed by this
new version.
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.


<!-- If this PR adds a new port, please uncomment and fill out this
checklist:

- [ ] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] The name of the port matches an existing name for this component
on https://repology.org/ if possible, and/or is strongly associated with
that component on search engines.
- [ ] Optional dependencies are resolved in exactly one way. For
example, if the component is built with CMake, all `find_package` calls
are REQUIRED, are satisfied by `vcpkg.json`'s declared dependencies, or
disabled with
[CMAKE_DISABLE_FIND_PACKAGE_Xxx](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html).
- [ ] The versioning scheme in `vcpkg.json` matches what upstream says.
- [ ] The license declaration in `vcpkg.json` matches what upstream
says.
- [ ] The installed as the "copyright" file matches what upstream says.
- [ ] The source code of the component installed comes from an
authoritative source.
- [ ] The generated "usage text" is accurate. See
[adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md)
for context.
- [ ] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [ ] Only one version is in the new port's versions file.
- [ ] Only one version is added to each modified port's versions file.

END OF NEW PORT CHECKLIST (delete this line) -->
2024-04-09 11:26:54 -04:00

67 lines
3.0 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65f3c73..586d582 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -209,14 +209,8 @@ endif()
#DisAsm/Zydis
if (POLYHOOK_USE_EXTERNAL_ZYDIS)
- find_library(ZYDIS_LIBRARY NAMES zydis)
- find_library(ZYCORE_LIBRARY NAMES zycore)
- find_path(ZYDIS_INCLUDE_DIR NAMES zydis/zydis.h)
- find_path(ZYCORE_INCLUDE_DIR NAMES zycore/zycore.h)
- target_link_libraries(${PROJECT_NAME} PUBLIC ${ZYDIS_LIBRARY})
- target_link_libraries(${PROJECT_NAME} PUBLIC ${ZYCORE_LIBRARY})
- target_include_directories(${PROJECT_NAME} PUBLIC ${ZYDIS_INCLUDE_DIR})
- target_include_directories(${PROJECT_NAME} PUBLIC ${ZYCORE_INCLUDE_DIR})
+ find_package(zydis REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PUBLIC Zydis::Zydis)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:Zydis>)
target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/zydis/include>)
@@ -229,10 +223,8 @@ install(FILES ${PROJECT_SOURCE_DIR}/polyhook2/ZydisDisassembler.hpp DESTINATION
function(link_asmjit)
if (POLYHOOK_USE_EXTERNAL_ASMJIT)
- find_library(ASMJIT_LIBRARY NAMES asmjit)
- find_path(ASMJIT_INCLUDE_DIR NAMES asmjit/asmjit.h)
- target_link_libraries(${PROJECT_NAME} PRIVATE ${ASMJIT_LIBRARY})
- target_include_directories(${PROJECT_NAME} PUBLIC ${ASMJIT_INCLUDE_DIR})
+ find_package(asmjit REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PRIVATE asmjit::asmjit)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE $<BUILD_INTERFACE:asmjit>)
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${ASMJIT_SRC}>")
@@ -244,10 +236,8 @@ if(POLYHOOK_FEATURE_DETOURS)
link_asmjit()
if (POLYHOOK_USE_EXTERNAL_ASMTK)
- find_library(ASMTK_LIBRARY NAMES asmtk)
- find_path(ASMTK_INCLUDE_DIR NAMES asmtk/asmtk.h)
- target_link_libraries(${PROJECT_NAME} PUBLIC ${ASMTK_LIBRARY})
- target_include_directories(${PROJECT_NAME} PUBLIC ${ASMTK_INCLUDE_DIR})
+ find_package(asmtk REQUIRED)
+ target_link_libraries(${PROJECT_NAME} PRIVATE asmjit::asmtk)
else()
target_link_libraries(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:asmtk>)
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${ASMTK_SRC}>")
diff --git a/polyhook_2-config.cmake.in b/polyhook_2-config.cmake.in
index 709f8b5..599d1f7 100644
--- a/polyhook_2-config.cmake.in
+++ b/polyhook_2-config.cmake.in
@@ -10,5 +10,14 @@ set(POLYHOOK_FEATURE_INLINENTD @POLYHOOK_FEATURE_INLINENTD@)
set(POLYHOOK_FEATURE_PE @POLYHOOK_FEATURE_PE@)
set(POLYHOOK_FEATURE_VIRTUALS @POLYHOOK_FEATURE_VIRTUALS@)
+include(CMakeFindDependencyMacro)
+find_dependency(Zydis)
+if(POLYHOOK_FEATURE_DETOURS)
+ find_dependency(asmjit)
+endif()
+if(POLYHOOK_FEATURE_INLINENTD)
+ find_dependency(asmtk)
+endif()
+
get_filename_component(POLYHOOK_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${POLYHOOK_CMAKE_DIR}/PolyHook_2-targets.cmake")