From 28a13209a2c70871db6539e161aebc27e330fa92 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Thu, 6 Dec 2018 23:20:48 +0100 Subject: [PATCH] CMake: Compile and link with -pthread when using pthread --- build/cmake/functions.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 57c24ea068..088d685eb2 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -105,6 +105,10 @@ function(wx_set_common_target_properties target_name) endif() # TODO: add warning flags for other compilers endif() + if(CMAKE_USE_PTHREADS_INIT) + target_compile_options(${target_name} PRIVATE "-pthread") + set_target_properties(${target_name} PROPERTIES LINK_FLAGS "-pthread") + endif() endfunction() # Set common properties on wx library target