Skip to content

Commit

Permalink
[build] fix cmake run loop and set rpath
Browse files Browse the repository at this point in the history
  • Loading branch information
prife committed May 12, 2020
1 parent 0d1137d commit e32f131
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e32f131

Please sign in to comment.