2023-07-12 02:57:41 +08:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
2024-04-09 23:26:54 +08:00
|
|
|
index 65f3c73..586d582 100644
|
2023-07-12 02:57:41 +08:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2024-04-09 23:26:54 +08:00
|
|
|
@@ -209,14 +209,8 @@ endif()
|
2023-07-12 02:57:41 +08:00
|
|
|
|
|
|
|
#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>)
|
2024-04-09 23:26:54 +08:00
|
|
|
@@ -229,10 +223,8 @@ install(FILES ${PROJECT_SOURCE_DIR}/polyhook2/ZydisDisassembler.hpp DESTINATION
|
2023-07-12 02:57:41 +08:00
|
|
|
|
|
|
|
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}>")
|
2024-04-09 23:26:54 +08:00
|
|
|
@@ -244,10 +236,8 @@ if(POLYHOOK_FEATURE_DETOURS)
|
2023-07-12 02:57:41 +08:00
|
|
|
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}>")
|
2024-04-09 23:26:54 +08:00
|
|
|
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@)
|
2023-07-12 02:57:41 +08:00
|
|
|
set(POLYHOOK_FEATURE_PE @POLYHOOK_FEATURE_PE@)
|
|
|
|
set(POLYHOOK_FEATURE_VIRTUALS @POLYHOOK_FEATURE_VIRTUALS@)
|
|
|
|
|
|
|
|
+include(CMakeFindDependencyMacro)
|
|
|
|
+find_dependency(Zydis)
|
2024-04-09 23:26:54 +08:00
|
|
|
+if(POLYHOOK_FEATURE_DETOURS)
|
|
|
|
+ find_dependency(asmjit)
|
|
|
|
+endif()
|
|
|
|
+if(POLYHOOK_FEATURE_INLINENTD)
|
|
|
|
+ find_dependency(asmtk)
|
|
|
|
+endif()
|
2023-07-12 02:57:41 +08:00
|
|
|
+
|
|
|
|
get_filename_component(POLYHOOK_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
|
|
include("${POLYHOOK_CMAKE_DIR}/PolyHook_2-targets.cmake")
|