use find_library for pthread (issue #496)

This commit is contained in:
Daan 2021-12-13 13:10:33 -08:00
parent c858690dea
commit d575aacfde
1 changed files with 9 additions and 6 deletions

View File

@ -210,12 +210,13 @@ endif()
if(WIN32)
list(APPEND mi_libraries psapi shell32 user32 advapi32 bcrypt)
else()
if(NOT ${CMAKE_C_COMPILER} MATCHES "android")
list(APPEND mi_libraries pthread)
find_library(LIBRT rt)
if(LIBRT)
list(APPEND mi_libraries ${LIBRT})
endif()
find_library(LIBPTHREAD pthread)
if (LIBPTHREAD)
list(APPEND mi_libraries ${LIBPTHREAD})
endif()
find_library(LIBRT rt)
if(LIBRT)
list(APPEND mi_libraries ${LIBRT})
endif()
endif()
@ -270,6 +271,8 @@ else()
message(STATUS "C Compiler : ${CMAKE_C_COMPILER}")
endif()
message(STATUS "Compiler flags : ${mi_cflags}")
message(STATUS "Compiler defines : ${mi_defines}")
message(STATUS "Link libraries : ${mi_libraries}")
message(STATUS "Build targets : ${mi_build_targets}")
message(STATUS "")