1# See https://github.com/richfelker/musl-cross-make 2 3if(NOT MUSL_HOME) 4 set(MUSL_HOME $ENV{MUSL_HOME}) 5endif() 6if(NOT MUSL_HOME) 7 message(FATAL_ERROR "Please setup MUSL_HOME environment variable") 8endif() 9 10set(MUSL_CFG x86_64-linux-musl) 11set(CMAKE_SYSTEM_NAME Linux) 12set(CMAKE_SYSTEM_PROCESSOR x86_64) 13set(CROSS_HOST x86_64-unknown-linux) 14 15set(CMAKE_FIND_ROOT_PATH "${MUSL_HOME}/${MUSL_CFG};${FIND_ROOT};${CMAKE_BINARY_DIR}") 16set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 17set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 18set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 19 20set(CMAKE_C_COMPILER ${MUSL_HOME}/bin/${MUSL_CFG}-gcc) 21set(CMAKE_CXX_COMPILER ${MUSL_HOME}/bin/${MUSL_CFG}-g++) 22 23set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static") 24set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") 25