From 352898e88bc1500df4385d1433d7ad9414b29234 Mon Sep 17 00:00:00 2001 From: Alexandre Bouvier Date: Tue, 24 Aug 2021 12:28:44 +0200 Subject: [PATCH] cmake: Add options to unbundle Zydis --- CMakeLists.txt | 5 +++++ externals/CMakeLists.txt | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13e8434e..f052b4a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,6 +137,11 @@ if (DYNARMIC_NO_BUNDLED_XBYAK AND NOT TARGET xbyak) endif() endif() +if (DYNARMIC_NO_BUNDLED_ZYDIS AND NOT TARGET Zydis) + find_package(Zydis REQUIRED) + add_library(Zydis ALIAS Zydis::Zydis) +endif() + # Enable unit-testing. enable_testing(true) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 2f937307..32d80773 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -49,7 +49,9 @@ endif() # zydis -option(ZYDIS_BUILD_TOOLS "" OFF) -option(ZYDIS_BUILD_EXAMPLES "" OFF) -set(ZYDIS_ZYCORE_PATH "${CMAKE_CURRENT_LIST_DIR}/zycore" CACHE PATH "") -add_subdirectory(zydis EXCLUDE_FROM_ALL) +if (NOT TARGET Zydis) + option(ZYDIS_BUILD_TOOLS "" OFF) + option(ZYDIS_BUILD_EXAMPLES "" OFF) + set(ZYDIS_ZYCORE_PATH "${CMAKE_CURRENT_LIST_DIR}/zycore" CACHE PATH "") + add_subdirectory(zydis EXCLUDE_FROM_ALL) +endif()