aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMakeModules
diff options
context:
space:
mode:
authorLioncash <[email protected]>2018-04-18 10:20:12 -0400
committerMerryMage <[email protected]>2020-04-22 20:46:16 +0100
commitcd0b71159ab51f49a8d392c0a284735ffb7601c5 (patch)
tree58ae76ad8466ac0c4d3c690469a11e6eb4152865 /CMakeModules
parent181c3b07905cb9e770e0221c2e59d9752f9da379 (diff)
downloaddynarmic-cd0b71159ab51f49a8d392c0a284735ffb7601c5.tar.gz
dynarmic-cd0b71159ab51f49a8d392c0a284735ffb7601c5.zip
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.
Diffstat (limited to 'CMakeModules')
-rw-r--r--CMakeModules/FindUnicorn.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/CMakeModules/FindUnicorn.cmake b/CMakeModules/FindUnicorn.cmake
index 35590b0c..1383bacb 100644
--- a/CMakeModules/FindUnicorn.cmake
+++ b/CMakeModules/FindUnicorn.cmake
@@ -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)