Basically, in your module CMakeLists.txt add a line like:

target_link_libraries(${MODULE_TARGET} pthread)

MODULE_TARGET is a variable that is accessible after the MITK_CREATE_MODULE 
macro. If you need to add compiler options like -pthread, you can do something 
like:

if(TARGET ${MODULE_TARGET})
  target_compile_options(${MODULE_TARGET} ...)
endif()

Depending on how clean you want your solution to be you should make proper 
checks before the line(s) above or even use the FindThreads module of CMake: 
https://cmake.org/cmake/help/v3.5/module/FindThreads.html

From: Pukhlikov Mikhail [mailto:mikhail.pukhli...@outlook.com]
Sent: Mittwoch, 3. Februar 2016 09:47
To: mitk-users@lists.sourceforge.net
Subject: [mitk-users] How to add -lpthread for linux only with 
MITK_CREATE_MODULE

How to add -lpthread for linux only with MITK_CREATE_MODULE

Seems like there is not obvious linking with boost log on linux and I need to 
pass pthread to module by myself

how to add linkling with pthread to module cmake?

Thank you!
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to