cmake: Add support for cross-compiling for Windows.
[cvc5.git] / cmake / Toolchain-mingw64.cmake
1 # Toolchain file for building for Windows from Ubuntu.
2 #
3 # Use: cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw64.cmake
4
5 SET(CMAKE_SYSTEM_NAME Windows)
6
7 set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
8
9 SET(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
10 SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
11 SET(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
12
13 # Set target environment path
14 SET(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
15
16 # Adjust the default behaviour of the find_XXX() commands:
17 # search headers and libraries in the target environment, search
18 # programs in the host environment
19 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
20 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
21 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
22
23 set(CVC4_WINDOWS_BUILD TRUE)