zlog/cmake/LoadLibraries.cmake

23 lines
691 B
CMake
Raw Normal View History

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