Use Threads::Threads interface library in cmake

in addition to passing ${CMAKE_THREAD_LIBS_INIT} to the linker, this
interface library will also add -pthread to the compile options when
supported

Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
Casey Bodley
2016-06-15 22:03:18 -04:00
committed by Vinnie Falco
parent 908ac75f7c
commit 28bd98073e
4 changed files with 8 additions and 8 deletions

View File

@@ -13,7 +13,7 @@ add_executable (http-crawl
)
if (NOT WIN32)
target_link_libraries(http-crawl ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(http-crawl ${Boost_LIBRARIES} Threads::Threads)
endif()
add_executable (http-server
@@ -26,7 +26,7 @@ add_executable (http-server
)
if (NOT WIN32)
target_link_libraries(http-server ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(http-server ${Boost_LIBRARIES} Threads::Threads)
endif()
add_executable (http-example
@@ -35,7 +35,7 @@ add_executable (http-example
)
if (NOT WIN32)
target_link_libraries(http-example ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(http-example ${Boost_LIBRARIES} Threads::Threads)
endif()
add_executable (websocket-example
@@ -44,5 +44,5 @@ add_executable (websocket-example
)
if (NOT WIN32)
target_link_libraries(websocket-example ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(websocket-example ${Boost_LIBRARIES} Threads::Threads)
endif()

View File

@@ -34,5 +34,5 @@ add_executable (core-tests
)
if (NOT WIN32)
target_link_libraries(core-tests ${Boost_LIBRARIES})
target_link_libraries(core-tests ${Boost_LIBRARIES} Threads::Threads)
endif()

View File

@@ -31,7 +31,7 @@ add_executable (http-tests
)
if (NOT WIN32)
target_link_libraries(http-tests ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(http-tests ${Boost_LIBRARIES} Threads::Threads)
endif()
add_executable (bench-tests

View File

@@ -21,7 +21,7 @@ add_executable (websocket-tests
)
if (NOT WIN32)
target_link_libraries(websocket-tests ${Boost_LIBRARIES})
target_link_libraries(websocket-tests ${Boost_LIBRARIES} Threads::Threads)
endif()
add_executable (websocket-echo
@@ -32,5 +32,5 @@ add_executable (websocket-echo
)
if (NOT WIN32)
target_link_libraries(websocket-echo ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(websocket-echo ${Boost_LIBRARIES} Threads::Threads)
endif()