Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add toolchain-i686-w64-mingw32.cmake for cross compiling

generic usage for cmake-enabled projects:
  $ cmake -DCMAKE_TOOLCHAIN_FILE=CMakeModules/toolchain-i686-w64-mingw32.cmake \
          -DCMAKE_INSTALL_PREFIX=$HOME/i686-w64-mingw32 \
          -DCMAKE_BUILD_TYPE=Debug
  $ make -j4 && make install

to switch back - delete CMakeCache.txt and rerun cmake w/o specifying toolchain

tested on Debian wheezy/sid with 'mingw-w64' package installed.
  • Loading branch information...
commit 1a880f8709b5280f335206b30677e2b764b1c187 1 parent 36bc608
@winex winex authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 CMakeModules/toolchain-i686-w64-mingw32.cmake
View
20 CMakeModules/toolchain-i686-w64-mingw32.cmake
@@ -0,0 +1,20 @@
+# the name of the target operating system
+set(CMAKE_SYSTEM_NAME Windows)
+
+# which compilers to use for C and C++
+set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
+set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
+set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
+
+# here is the target environment located
+set(CMAKE_FIND_ROOT_PATH
+ /usr/i686-w64-mingw32
+ ~/i686-w64-mingw32
+)
+
+# 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)
Please sign in to comment.
Something went wrong with that request. Please try again.