set(CMAKE_SYSTEM_NAME Darwin)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(OSXCROSS_TARGET_DIR "/soft/osxcross/target")
set(_DAWRIN_VERSION "apple-darwin18")

set(CMAKE_C_COMPILER           ${OSXCROSS_TARGET_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}-${_DAWRIN_VERSION}-clang )
set(CMAKE_CXX_COMPILER         ${OSXCROSS_TARGET_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}-${_DAWRIN_VERSION}-clang++ )
set(CMAKE_RANLIB               ${OSXCROSS_TARGET_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}-${_DAWRIN_VERSION}-ranlib CACHE FILEPATH "ranlib" )
set(CMAKE_AR                   ${OSXCROSS_TARGET_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}-${_DAWRIN_VERSION}-ar CACHE FILEPATH "ar" )
set(CMAKE_INSTALL_NAME_TOOL    ${OSXCROSS_TARGET_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}-${_DAWRIN_VERSION}-install_name_tool CACHE FILEPATH "install_name_tool" )
set(CMAKE_OTOOL                ${OSXCROSS_TARGET_DIR}/bin/${CMAKE_SYSTEM_PROCESSOR}-${_DAWRIN_VERSION}-otool CACHE FILEPATH "otool" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,@executable_path/../Frameworks,-rpath,@executable_path/lib,-rpath,@loader_path/../lib")

list(APPEND CMAKE_PREFIX_PATH "/soft/osx")
set(CMAKE_FIND_ROOT_PATH ${OSXCROSS_TARGET_DIR}/${CMAKE_SYSTEM_PROCESSOR}-${_DAWRIN_VERSION} ${OSXCROSS_TARGET_DIR}/SDK/MacOSX10.14.sdk ${CMAKE_PREFIX_PATH}/lib)
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)
include_directories(${CMAKE_PREFIX_PATH}/include)
#link_directories(${CMAKE_PREFIX_PATH}/lib)
cmake_policy(SET CMP0025 NEW)
