1# 2# Copyright © 2020 Arm Ltd and Contributors. All rights reserved. 3# SPDX-License-Identifier: MIT 4# 5 6# toolchain file for building for Windows on an Ubuntu Linux system. 7# 8# Typical usage: 9# *) install cross compiler: `sudo apt-get install mingw-w64` 10# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/toolchain-x86-ubuntu-mingw64.cmake 11 12set(CMAKE_SYSTEM_NAME Windows) 13set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) 14 15# cross compilers to use for C and C++ 16set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) 17set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) 18 19# target environment on the build host system 20# set 1st to dir with the cross compiler's C/C++ headers/libs 21set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) 22 23# modify default behavior of FIND_XXX() commands to 24# search for headers/libs in the target environment and 25# search for programs in the build host environment 26set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 27set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 28set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 29