Skip to content

Commit 7754b3f

Browse files
committed
cmake: add MinGW CMake toolchains for cross-compilation
1 parent 7b01e2b commit 7754b3f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
# Find programs using host paths and headers/libraries using target paths
11+
# FIXME: not respected when cmake invokes pkg-config
12+
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
13+
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
14+
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
# Find programs using host paths and headers/libraries using target paths
11+
# FIXME: not respected when cmake invokes pkg-config
12+
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
13+
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
14+
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

0 commit comments

Comments
 (0)