Skip to content

Commit 6526e00

Browse files
fix(win32): clock_* requires to link winpthread
MinGW is totally garbage, Glibc since 2.17 have move clock_* from librt to libc so single-thread program can use these functions without the overheads associated with multi-thread support. But MinGW doesn't. Signed-off-by: Coelacanthus <uwu@coelacanthus.name>
1 parent 3628d76 commit 6526e00

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

utils/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ install(TARGETS lpac-utils LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
33
target_link_libraries(lpac-utils PRIVATE ${CJSON_LIBRARY} euicc)
44
target_compile_options(lpac-utils PRIVATE -Wall -Wextra)
55

6-
# Only useful on Windows, and will lead to invalid arguments on ld.gold.
76
if(WIN32)
7+
# Only useful on Windows, and will lead to invalid arguments on ld.gold.
88
target_link_options(lpac-utils PRIVATE "LINKER:--export-all-symbols")
9+
# FIXME: MinGW is totally garbage, Glibc since 2.17 have move clock_* from librt to libc so single-thread
10+
# program can use these functions without the overheads associated with multi-thread support.
11+
# But MinGW doesn't.
12+
find_package(Threads REQUIRED)
13+
target_link_libraries(lpac-utils PRIVATE Threads::Threads)
914
endif()
1015

1116
target_sources(

0 commit comments

Comments
 (0)