Skip to content

Commit eb64785

Browse files
committed
cmake: Fix linking with MinGW
Don't explicitly link with ntdll and Netapi32 under MinGW. Fix ODE library name detection under MinGW. Signed-off-by: Alexander Shishkin <[email protected]>
1 parent 82162b0 commit eb64785

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten"))
6666
set(PNG_LIBRARY PNG::PNG)
6767
set(OPENAL_LIBRARY OpenAL::OpenAL)
6868
set(GLEW_LIBRARIES GLEW::GLEW)
69-
if (WIN32)
69+
if (WIN32 AND NOT MINGW)
7070
set(EXTRA_LIBRARIES ntdll Netapi32)
71-
else ()
71+
elseif (NOT WIN32)
7272
set(EXTRA_LIBRARIES m pthread stdc++)
7373
endif ()
7474
endif ()
@@ -86,7 +86,11 @@ wlibc_setup(deps/src/windows-libc)
8686
set(ODE_ROOT "${CMAKE_CURRENT_BINARY_DIR}/ode")
8787

8888
if (WIN32)
89-
set(ODE_LIBRARY "${ODE_ROOT}/lib/ode_doubles${W32LIBSUFFIX}.lib")
89+
if (MINGW)
90+
set(ODE_LIBRARY "${ODE_ROOT}/lib/libode_doubles${W32LIBSUFFIX}.a")
91+
else ()
92+
set(ODE_LIBRARY "${ODE_ROOT}/lib/ode_doubles${W32LIBSUFFIX}.lib")
93+
endif ()
9094
else ()
9195
set(ODE_LIBRARY "${ODE_ROOT}/lib/libode.a")
9296
endif ()

0 commit comments

Comments
 (0)