diff --git a/CMakeLists.txt b/CMakeLists.txt index c62398ee..aee640fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,22 @@ if (NOT TARGET boost) target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIRS}) endif() +if (DYNARMIC_NO_BUNDLED_FMT) + find_package(fmt REQUIRED) + add_library(fmt ALIAS fmt::fmt) +endif() + +if (DYNARMIC_NO_BUNDLED_ROBIN_MAP) + find_package(tsl-robin-map REQUIRED) +endif() + +if (DYNARMIC_NO_BUNDLED_XBYAK) + if (ARCHITECTURE STREQUAL "x86" OR ARCHITECTURE STREQUAL "x86_64") + find_package(xbyak REQUIRED) + add_library(xbyak ALIAS xbyak::xbyak) + endif() +endif() + # Enable unit-testing. enable_testing(true) @@ -136,6 +152,11 @@ if (DYNARMIC_TESTS_USE_UNICORN) find_package(Unicorn REQUIRED) endif() +if (DYNARMIC_TESTS AND DYNARMIC_NO_BUNDLED_CATCH) + find_package(Catch2 REQUIRED) + add_library(catch ALIAS Catch2::Catch2) +endif() + # Pull in externals CMakeLists for libs where available add_subdirectory(externals) diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 5326e2e6..2f937307 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -4,12 +4,14 @@ # catch -add_library(catch INTERFACE) -target_include_directories(catch INTERFACE $) +if (DYNARMIC_TESTS AND NOT TARGET catch) + add_library(catch INTERFACE) + target_include_directories(catch INTERFACE $) +endif() # fmt -if (NOT DYNARMIC_NO_BUNDLED_FMT) +if (NOT TARGET fmt) # fmtlib formatting library add_subdirectory(fmt) endif() @@ -21,9 +23,11 @@ target_include_directories(mp INTERFACE $") +if (NOT TARGET tsl::robin_map) + add_library(robin_map INTERFACE) + add_library(tsl::robin_map ALIAS robin_map) + target_include_directories(robin_map SYSTEM INTERFACE "$") +endif() # vixl