Skip to content

Commit e50f644

Browse files
committed
cmake: add MinGW CMake toolchains for cross-compilation
1 parent 04ead53 commit e50f644

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Target operating system and architecture
2+
set( CMAKE_SYSTEM_NAME Windows )
3+
set( CMAKE_SYSTEM_PROCESSOR x86 )
4+
5+
# C/C++ compilers
6+
set( CMAKE_C_COMPILER i686-w64-mingw32-gcc )
7+
set( CMAKE_CXX_COMPILER i686-w64-mingw32-g++ )
8+
set( CMAKE_RC_COMPILER i686-w64-mingw32-windres )
9+
10+
# Target prefix
11+
set( CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 )
12+
13+
# Find programs using host paths and headers/libraries using target paths
14+
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
15+
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
16+
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Target operating system and architecture
2+
set( CMAKE_SYSTEM_NAME Windows )
3+
set( CMAKE_SYSTEM_PROCESSOR x86_64 )
4+
5+
# C/C++ compilers
6+
set( CMAKE_C_COMPILER x86_64-w64-mingw32-gcc )
7+
set( CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++ )
8+
set( CMAKE_RC_COMPILER x86_64-w64-mingw32-windres )
9+
10+
# Target prefix
11+
set( CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 )
12+
13+
# Find programs using host paths and headers/libraries using target paths
14+
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
15+
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
16+
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

0 commit comments

Comments
 (0)