diff --git a/CMakeLists.txt b/CMakeLists.txt index f79ae2e..e8f8892 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,14 @@ cmake_minimum_required(VERSION 3.5.1) +if (CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") + set(CMAKE_C_COMPILER /usr/bin/clang) + set(CMAKE_CXX_COMPILER /usr/bin/clang++) +endif() + project(n-adb) if ((CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") AND (NOT (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64"))) -set(CMAKE_C_COMPILER /usr/bin/clang) -set(CMAKE_CXX_COMPILER /usr/bin/clang++) -set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++") + set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -stdlib=libc++") endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 80a8709..b2b6976 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -176,6 +176,9 @@ if (WIN32) target_link_options(${PROJECT_NAME} PRIVATE -municode -static-libgcc -static-libstdc++) elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") set(LINK_LIBS ${LINK_LIBS} rt) + set_target_properties(${PROJECT_NAME} PROPERTIES + LINK_FLAGS "-Wl,-rpath=/opt/lib/android/" + BUILD_WITH_INSTALL_RPATH 1) elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") FIND_LIBRARY(IOKit_LIBRARY IOKit) FIND_LIBRARY(Foundation_LIBRARY Foundation)