2017-03-30 16:58:57 +00:00
|
|
|
# - Find Radare2 (libr)
|
|
|
|
#
|
|
|
|
# RADARE2_FOUND - True if libr has been found.
|
2017-05-05 11:09:38 +00:00
|
|
|
# RADARE2_INCLUDE_DIRS - libr include directory
|
2017-03-30 16:58:57 +00:00
|
|
|
# RADARE2_LIBRARIES - List of libraries when using libr.
|
2017-05-05 11:09:38 +00:00
|
|
|
# RADARE2_LIBRARY_DIRS - libr library directories
|
|
|
|
#
|
|
|
|
# If libr was found using find_library and not pkg-config, the following variables will also be set:
|
2017-03-30 16:58:57 +00:00
|
|
|
# RADARE2_LIBRARY_<name> - Path to library r_<name>
|
|
|
|
|
2017-05-05 11:09:38 +00:00
|
|
|
if(WIN32)
|
|
|
|
find_path(RADARE2_INCLUDE_DIRS
|
|
|
|
NAMES r_core.h r_bin.h r_util.h
|
2017-03-30 16:58:57 +00:00
|
|
|
HINTS
|
2017-05-05 11:09:38 +00:00
|
|
|
"$ENV{HOME}/bin/prefix/radare2/include/libr"
|
|
|
|
/usr/local/include/libr
|
|
|
|
/usr/include/libr)
|
|
|
|
|
|
|
|
set(RADARE2_LIBRARY_NAMES
|
|
|
|
core
|
|
|
|
config
|
|
|
|
cons
|
|
|
|
io
|
|
|
|
util
|
|
|
|
flag
|
|
|
|
asm
|
|
|
|
debug
|
|
|
|
hash
|
|
|
|
bin
|
|
|
|
lang
|
|
|
|
io
|
|
|
|
anal
|
|
|
|
parse
|
|
|
|
bp
|
|
|
|
egg
|
|
|
|
reg
|
|
|
|
search
|
|
|
|
syscall
|
|
|
|
socket
|
|
|
|
fs
|
|
|
|
magic
|
|
|
|
crypto)
|
|
|
|
|
|
|
|
set(RADARE2_LIBRARIES "")
|
|
|
|
set(RADARE2_LIBRARIES_VARS "")
|
|
|
|
foreach(libname ${RADARE2_LIBRARY_NAMES})
|
|
|
|
find_library(RADARE2_LIBRARY_${libname}
|
|
|
|
r_${libname}
|
|
|
|
HINTS
|
|
|
|
"$ENV{HOME}/bin/prefix/radare2/lib"
|
|
|
|
/usr/local/lib
|
|
|
|
/usr/lib)
|
|
|
|
|
|
|
|
list(APPEND RADARE2_LIBRARIES ${RADARE2_LIBRARY_${libname}})
|
|
|
|
list(APPEND RADARE2_LIBRARIES_VARS "RADARE2_LIBRARY_${libname}")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set(RADARE2_LIBRARY_DIRS "")
|
|
|
|
else()
|
|
|
|
# support sys/user.sh install
|
|
|
|
set(RADARE2_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH})
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/bin/prefix/radare2")
|
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_search_module(RADARE2 REQUIRED r_core)
|
2017-03-30 16:58:57 +00:00
|
|
|
|
2017-05-05 11:09:38 +00:00
|
|
|
# reset CMAKE_PREFIX_PATH
|
|
|
|
set(CMAKE_PREFIX_PATH ${RADARE2_CMAKE_PREFIX_PATH_TEMP})
|
|
|
|
mark_as_advanced(RADARE2_CMAKE_PREFIX_PATH_TEMP)
|
|
|
|
endif()
|
2017-03-30 16:58:57 +00:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2017-05-05 11:09:38 +00:00
|
|
|
find_package_handle_standard_args(RADARE2 REQUIRED_VARS RADARE2_LIBRARIES RADARE2_INCLUDE_DIRS)
|
2017-03-30 16:58:57 +00:00
|
|
|
|
2017-04-03 00:18:41 +00:00
|
|
|
mark_as_advanced(RADARE2_LIBRARIES_VARS)
|