By default search r2 in /usr/local used by sys/install.sh. (#2128)

This commit is contained in:
karliss 2020-04-07 12:39:15 +03:00 committed by GitHub
parent 7110d73979
commit 55d4ee3ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -12,6 +12,8 @@ include(CutterInstallDirs)
set(CUTTER_PYTHON_MIN 3.5) set(CUTTER_PYTHON_MIN 3.5)
option(CUTTER_USE_BUNDLED_RADARE2 "Use radare2 from src/radare2 submodule instead of searching for it on the system" OFF) option(CUTTER_USE_BUNDLED_RADARE2 "Use radare2 from src/radare2 submodule instead of searching for it on the system" OFF)
option(CUTTER_USE_ADDITIONAL_RADARE2_PATHS "Search radare2 in additional paths which are not part of default system library paths.\
Disable this option if you are linking against radare2 pacakged as proper system library or in a custom path and additional are paths causing problems." ON)
option(CUTTER_ENABLE_PYTHON "Enable Python integration. Requires Python >= ${CUTTER_PYTHON_MIN}." OFF) option(CUTTER_ENABLE_PYTHON "Enable Python integration. Requires Python >= ${CUTTER_PYTHON_MIN}." OFF)
option(CUTTER_ENABLE_PYTHON_BINDINGS "Enable generating Python bindings with Shiboken2. Unused if CUTTER_ENABLE_PYTHON=OFF." OFF) option(CUTTER_ENABLE_PYTHON_BINDINGS "Enable generating Python bindings with Shiboken2. Unused if CUTTER_ENABLE_PYTHON=OFF." OFF)
option(CUTTER_ENABLE_CRASH_REPORTS "Enable crash report system. Unused if CUTTER_ENABLE_CRASH_REPORTS=OFF" OFF) option(CUTTER_ENABLE_CRASH_REPORTS "Enable crash report system. Unused if CUTTER_ENABLE_CRASH_REPORTS=OFF" OFF)

View File

@ -72,9 +72,12 @@ if(WIN32)
INTERFACE_INCLUDE_DIRECTORIES "${Radare2_INCLUDE_DIRS}") INTERFACE_INCLUDE_DIRECTORIES "${Radare2_INCLUDE_DIRS}")
set(Radare2_TARGET Radare2::libr) set(Radare2_TARGET Radare2::libr)
else() else()
# support sys/user.sh install # support installation locations used by r2 scripts like sys/user.sh and sys/install.sh
set(Radare2_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH}) if(CUTTER_USE_ADDITIONAL_RADARE2_PATHS)
list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/bin/prefix/radare2") set(Radare2_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH})
list(APPEND CMAKE_PREFIX_PATH "$ENV{HOME}/bin/prefix/radare2") # sys/user.sh
list(APPEND CMAKE_PREFIX_PATH "/usr/local") # sys/install.sh
endif()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
if(CMAKE_VERSION VERSION_LESS "3.6") if(CMAKE_VERSION VERSION_LESS "3.6")
@ -84,7 +87,9 @@ else()
endif() endif()
# reset CMAKE_PREFIX_PATH # reset CMAKE_PREFIX_PATH
set(CMAKE_PREFIX_PATH ${Radare2_CMAKE_PREFIX_PATH_TEMP}) if(CUTTER_USE_ADDITIONAL_RADARE2_PATHS)
set(CMAKE_PREFIX_PATH ${Radare2_CMAKE_PREFIX_PATH_TEMP})
endif()
if((TARGET PkgConfig::Radare2) AND (NOT CMAKE_VERSION VERSION_LESS "3.11.0")) if((TARGET PkgConfig::Radare2) AND (NOT CMAKE_VERSION VERSION_LESS "3.11.0"))
set_target_properties(PkgConfig::Radare2 PROPERTIES IMPORTED_GLOBAL ON) set_target_properties(PkgConfig::Radare2 PROPERTIES IMPORTED_GLOBAL ON)