diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f4fe03d..74d4186d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,8 @@ include(CutterInstallDirs) 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_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_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) diff --git a/src/cmake/FindRadare2.cmake b/src/cmake/FindRadare2.cmake index 77c649e6..ec897124 100644 --- a/src/cmake/FindRadare2.cmake +++ b/src/cmake/FindRadare2.cmake @@ -72,9 +72,12 @@ if(WIN32) INTERFACE_INCLUDE_DIRECTORIES "${Radare2_INCLUDE_DIRS}") set(Radare2_TARGET Radare2::libr) 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") + # support installation locations used by r2 scripts like sys/user.sh and sys/install.sh + if(CUTTER_USE_ADDITIONAL_RADARE2_PATHS) + 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) if(CMAKE_VERSION VERSION_LESS "3.6") @@ -84,7 +87,9 @@ else() endif() # 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")) set_target_properties(PkgConfig::Radare2 PROPERTIES IMPORTED_GLOBAL ON)