2024-04-11 13:06:53 +07:00
|
|
|
# =======================================================
|
2023-02-10 13:52:34 +07:00
|
|
|
# 支持多线程
|
|
|
|
# 对于需要多线程的库,使用以下命令包含连接库:
|
|
|
|
# target_link_libraries(xxx ${CMAKE_THREAD_PREFER_PTHREAD})
|
2024-04-11 13:06:53 +07:00
|
|
|
# =======================================================
|
|
|
|
if (Need_THREAD)
|
2023-02-10 13:52:34 +07:00
|
|
|
find_package(Threads REQUIRED)
|
2024-04-11 13:06:53 +07:00
|
|
|
|
|
|
|
if (NOT CMAKE_THREAD_PREFER_PTHREAD)
|
2023-02-10 13:52:34 +07:00
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD ${CMAKE_THREAD_LIBS_INIT})
|
2024-04-11 13:06:53 +07:00
|
|
|
endif ()
|
|
|
|
|
2023-02-10 13:52:34 +07:00
|
|
|
message(STATUS "thread lib : ${CMAKE_THREAD_PREFER_PTHREAD}")
|
2024-04-11 13:06:53 +07:00
|
|
|
endif (Need_THREAD)
|
2023-02-10 13:52:34 +07:00
|
|
|
|
2024-04-11 13:06:53 +07:00
|
|
|
if (Need_UNIXEM)
|
2023-02-10 13:52:34 +07:00
|
|
|
find_package(Unixem)
|
2024-04-11 13:06:53 +07:00
|
|
|
|
2023-02-10 13:52:34 +07:00
|
|
|
if (NOT UNIXEM_FOUND)
|
|
|
|
message(FATAL_ERROR "unixem lib not found!")
|
2024-04-11 13:06:53 +07:00
|
|
|
endif ()
|
|
|
|
endif ()
|