Skip to content

Commit 2437b05

Browse files
committed
Setup MingW toolchains and fix linking issue.
1 parent aa4688d commit 2437b05

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

Source/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ target_link_libraries(${PROJECT_NAME}
1616

1717
if (MINGW)
1818
target_link_libraries(${PROJECT_NAME} ws2_32)
19+
target_link_options(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++)
1920
endif()
2021

2122
target_include_directories(${PROJECT_NAME} PUBLIC
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(CMAKE_SYSTEM_PROCESSOR x86)
3+
4+
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
5+
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
6+
7+
set(CMAKE_SYSROOT /usr/i686-w64-mingw32)
8+
set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
9+
10+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
12+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
13+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
14+
15+
add_compile_definitions(WINDOWS)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set(CMAKE_SYSTEM_NAME Windows)
2+
set(CMAKE_SYSTEM_PROCESSOR x86_64)
3+
4+
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
5+
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
6+
7+
set(CMAKE_SYSROOT /usr/x86_64-w64-mingw32)
8+
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
9+
10+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
12+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
13+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
14+
15+
add_compile_definitions(WINDOWS)

0 commit comments

Comments
 (0)