mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-03-13 12:42:57 +00:00
CMake: Make FindUnicorn introduce a unicorn target
Makes the find module do all the work of properly setting up the target instead of needing to do it in the main CMakeLists file.
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
# Exports:
|
||||
#
|
||||
# Variables:
|
||||
# LIBUNICORN_FOUND
|
||||
# LIBUNICORN_INCLUDE_DIR
|
||||
# LIBUNICORN_LIBRARY
|
||||
#
|
||||
# Target:
|
||||
# Unicorn::Unicorn
|
||||
#
|
||||
|
||||
find_path(LIBUNICORN_INCLUDE_DIR
|
||||
unicorn/unicorn.h
|
||||
@@ -14,4 +20,18 @@ find_library(LIBUNICORN_LIBRARY
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(unicorn DEFAULT_MSG LIBUNICORN_LIBRARY LIBUNICORN_INCLUDE_DIR)
|
||||
|
||||
if (UNICORN_FOUND)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
unset(THREADS_PREFER_PTHREAD_FLAG)
|
||||
|
||||
add_library(Unicorn::Unicorn UNKNOWN IMPORTED)
|
||||
set_target_properties(Unicorn::Unicorn PROPERTIES
|
||||
IMPORTED_LOCATION ${LIBUNICORN_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${LIBUNICORN_INCLUDE_DIR}
|
||||
INTERFACE_LINK_LIBRARIES Threads::Threads
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBUNICORN_INCLUDE_DIR LIBUNICORN_LIBRARY)
|
||||
|
||||
Reference in New Issue
Block a user