Skip to content

Instantly share code, notes, and snippets.

@pafmaf
Created July 1, 2016 13:07
Show Gist options
  • Save pafmaf/65d025a61ff306183f61573d9a8a48b3 to your computer and use it in GitHub Desktop.
Save pafmaf/65d025a61ff306183f61573d9a8a48b3 to your computer and use it in GitHub Desktop.
MinGW win toolchain example
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
SET(MINGW_BASE C:/msys64/mingw64)
SET(MINGW_AR ${MINGW_BASE}/bin/ar.exe)
# which compilers to use for C and C++
SET(CMAKE_MAKE_PROGRAM ${MINGW_BASE}/bin/mingw32-make.exe)
SET(CMAKE_C_COMPILER ${MINGW_BASE}/bin/gcc.exe)
SET(CMAKE_CXX_COMPILER ${MINGW_BASE}/bin/g++.exe)
# here is the target environment located
SET(CMAKE_FIND_ROOT_PATH ${MINGW_BASE}/ )
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment