File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Sample toolchain file for building for Windows from an Ubuntu Linux system.
2+ #
3+ # Typical usage:
4+ # *) install cross compiler: `sudo apt-get install mingw-w64`
5+ # *) cd build
6+ # *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake ..
7+ # This is free and unencumbered software released into the public domain.
8+
9+ set (CMAKE_SYSTEM_NAME Windows)
10+ set (TOOLCHAIN_PREFIX x86_64-w64-mingw32)
11+ set (CMAKE_SYSTEM_PROCESSOR x86_64)
12+
13+ # cross compilers to use for C, C++ and Fortran
14+ set (CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX} -gcc)
15+ set (CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX} -g++)
16+ set (CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX} -gfortran)
17+ set (CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX} -windres)
18+
19+ # target environment on the build host system
20+ set (CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX} )
21+
22+ # modify default behavior of FIND_XXX() commands
23+ set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24+ set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
25+ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
You can’t perform that action at this time.
0 commit comments