set(CMAKE_SYSTEM_NAME Lemon)

if (NOT DEFINED ENV{LEMON_SYSROOT})
    message(FATAL_ERROR "LEMON_SYSROOT is not set")
endif()

set(CMAKE_SYSROOT $ENV{LEMON_SYSROOT})
set(CMAKE_FIND_ROOT_PATH $ENV{LEMON_SYSROOT})

set(CMAKE_MODULE_PATH $ENV{LEMON_SYSROOT}/system/lib/cmake)
#set(CMAKE_PREFIX_PATH $ENV{LEMON_SYSROOT}/system)
set(CMAKE_INSTALL_PREFIX /system)

list(APPEND CMAKE_SYSTEM_PREFIX_PATH
    /system
)

set(CMAKE_C_COMPILER lemon-clang)
set(CMAKE_CXX_COMPILER lemon-clang++)

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)

SET(LEMON 1)
SET(UNIX 1)

if (NOT DEFINED ENV{LEMON_BUILDROOT})
    message(FATAL_ERROR "LEMON_BUILDROOT is not set")
endif()
list(APPEND CMAKE_MODULE_PATH "$ENV{LEMON_BUILDROOT}/Scripts/CMake")
