Closed Foadsf closed 4 years ago
The pthreads
library is for Unix systems only. You wouldn't use it on Windows for multithreading. Hence, the "not found" message is likely just an FYI, not an error. As you say compilation succeeds, and presumably executables work as expected, would you say this is still an actual issue requiring some fix?
@schuhschuh how about using:
#ifdef _WIN32
#include <windows.h>
#else
#include <pthread.h>
#endif
Given that compllation succeeds, this should be the case in code. Note that the status message is from CMake's Find module, simply reporting what it has or hasn't found installed on your system. It's not a C++ compiler message.
On Sun, 22 Mar 2020, 23:19 Foad Sojoodi Farimani, notifications@github.com wrote:
@schuhschuh https://github.com/schuhschuh how about using:
ifdef _WIN32
include
else
include
endif
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cmake-basis/BASIS/issues/632#issuecomment-602292859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHOEWYRNGQUXJKKEVTOMUDRI2MIPANCNFSM4LO5O4WQ .
@schuhschuh Then I think we should modify the CMake scripts to do not check pthread if on Windows or MSVC. can we do that?
Note that BASIS itself does not check for pthreads itself, but a "Threads" library (also a valid query on Windows). It is CMake's official FindThreads.cmake module which emits this informational message. You may want to discuss this with the CMake developers themselves if you believe the behavior of FindThreads should be modified. IMHO This is normal behavior.
What can be done is to modify the CMake command find_package(Threads)
in config/Settings.cmake
to use QUIET
flat. This will silence messages from FindThreads with the downside of course that there is no feedback on whether or not a threading library was found.
Following this SO question, running the CMake command:
leads to:
I tried copy-pasting files
FindThreads.cmake
,FindPackageHandleStandardArgs.cmake
, andFindPackageMessage.cmake
from here with no avail. Though the compiling-installing commandseems to be working: