Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 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 | |
| 12 | set(CMAKE_SYSTEM_NAME Windows) |
| 13 | set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) |
| 14 | |
| 15 | # cross compilers to use for C and C++ |
| 16 | set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) |
| 17 | set(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 |
| 21 | set(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 |
| 26 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
| 27 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
| 28 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |