MSVC Pthread issue
Foadsf opened this issue · 5 comments
Following this SO question, running the CMake command:
cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/foobar/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON .. -G "Visual Studio 15 2017 Win64"
leads to:
-- Looking for pthread.h - not found
I tried copy-pasting files FindThreads.cmake
, FindPackageHandleStandardArgs.cmake
, and FindPackageMessage.cmake
from here with no avail. Though the compiling-installing command
cmake --build . --config release --target install
seems to be working:
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
@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.