cmake: Add options to unbundle some externals

This commit is contained in:
Alexandre Bouvier 2021-08-10 16:05:38 +02:00
parent 72f8abe11d
commit 33b89cca08
2 changed files with 31 additions and 6 deletions

View file

@ -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)

View file

@ -4,12 +4,14 @@
# catch
add_library(catch INTERFACE)
target_include_directories(catch INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/catch/include>)
if (DYNARMIC_TESTS AND NOT TARGET catch)
add_library(catch INTERFACE)
target_include_directories(catch INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/catch/include>)
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 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE
# robin-map
add_library(robin_map INTERFACE)
add_library(tsl::robin_map ALIAS robin_map)
target_include_directories(robin_map SYSTEM INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/robin-map/include>")
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 "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/robin-map/include>")
endif()
# vixl