1set(CMAKE_SYSTEM_NAME Linux)
2set(CMAKE_SYSTEM_PROCESSOR ppc64)
3set(CMAKE_SYSTEM_VERSION 1)
4
5set(CMAKE_C_COMPILER_TARGET "powerpc64-linux-gnu")
6set(CMAKE_CXX_COMPILER_TARGET "powerpc64-linux-gnu")
7
8set(CMAKE_CROSSCOMPILING TRUE)
9set(CMAKE_CROSSCOMPILING_EMULATOR qemu-ppc64 -L /usr/${CMAKE_C_COMPILER_TARGET}/)
10
11set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
12set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
13set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
14set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
15
16find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc)
17if(NOT C_COMPILER_FULL_PATH)
18    message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found")
19endif()
20set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH})
21
22find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++)
23if(CXX_COMPILER_FULL_PATH)
24    set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH})
25endif()
26