diff --git a/src/autowiring/CMakeLists.txt b/src/autowiring/CMakeLists.txt index 28671ff72..b07ac2cc1 100644 --- a/src/autowiring/CMakeLists.txt +++ b/src/autowiring/CMakeLists.txt @@ -163,13 +163,17 @@ endif() set_property(TARGET Autowiring PROPERTY FOLDER "Autowiring") # Might as well reference the boost libraries to satisfy link dependencies, if we know they exist -find_package(Boost COMPONENTS system date_time QUIET) +find_package(Boost COMPONENTS thread atomic system chrono date_time QUIET) if(Boost_FOUND) target_link_libraries(Autowiring ${Boost_LIBRARIES}) endif() -if(UNIX) - target_link_libraries(Autowiring pthread) +# Need multithreading services if available +find_package(Threads) +if(Threads_FOUND) + if(CMAKE_USE_PTHREADS_INIT) + target_link_libraries(Autowiring ${CMAKE_THREAD_LIBS_INIT}) + endif() endif() install(TARGETS Autowiring DESTINATION lib COMPONENT autowiring CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})