Skip to content

Instantly share code, notes, and snippets.

@take-cheeze
Created May 31, 2012 02:38
Show Gist options
  • Select an option

  • Save take-cheeze/2840600 to your computer and use it in GitHub Desktop.

Select an option

Save take-cheeze/2840600 to your computer and use it in GitHub Desktop.
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)
# which compilers to use for C and C++
include(CMakeForceCompiler)
cmake_force_c_compiler(i686-w64-mingw32-gcc GNU)
cmake_force_cxx_compiler(i686-w64-mingw32-g++ GNU)
set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
# here is the target environment located
set(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc $ENV{PWD}/mingw-install)
# 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