Skip to content

Commit 315268d

Browse files
fix(win32): clock_* requires to link winpthread
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 e2559d5 commit 315268d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

utils/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ 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: Glibc since 2.17 have move clock_* from librt to libc so
10+
# single-thread program can use these functions without the
11+
# overheads associated with multi-thread support.
12+
# But MinGW doesn't.
13+
find_package(Threads REQUIRED)
14+
target_link_libraries(lpac-utils PRIVATE Threads::Threads)
915
endif()
1016

1117
target_sources(

0 commit comments

Comments
 (0)