set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(triple "arm-linux-gnueabihf")
set(RPI_TOOLCHAIN "/usr/bin/${triple}")
#set(CMAKE_SYSROOT "/soft/pi/usr")

set(CMAKE_LIBRARY_ARCHITECTURE ${triple})
set(CMAKE_C_COMPILER    ${RPI_TOOLCHAIN}-gcc)
set(CMAKE_CXX_COMPILER  ${RPI_TOOLCHAIN}-g++)
set(CMAKE_RANLIB        ${RPI_TOOLCHAIN}-ranlib CACHE FILEPATH "ranlib")
set(CMAKE_AR            ${RPI_TOOLCHAIN}-ar CACHE FILEPATH "ar")
set(CMAKE_READELF       ${RPI_TOOLCHAIN}-readelf CACHE FILEPATH "readelf")
set(CMAKE_DPKG_WORKDIR  /soft/pi/var/lib/dpkg/)

list(APPEND CMAKE_PREFIX_PATH "/soft/pi/usr")
#set(CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH}/lib/${triple})
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY FIRST)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE FIRST)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE FIRST)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath-link,/soft/pi/lib/${triple}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
include_directories(${CMAKE_PREFIX_PATH}/include ${CMAKE_PREFIX_PATH}/include/${triple})
cmake_policy(SET CMP0025 NEW)
