diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e1abf32d9c..26e435e4263 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,15 +181,17 @@ else() endif() if(USE_INTEGRATED_LIBS) - set(PThreads_windows_DIR ${CMAKE_CURRENT_LIST_DIR}/3rdparty/pthreads CACHE PATH "Path where pthreads for windows can be located") + set(PThreads4W_ROOT ${CMAKE_CURRENT_LIST_DIR}/3rdparty/pthreads CACHE PATH "Path where pthreads for windows can be located") endif() set(Stb_DIR ${CMAKE_CURRENT_LIST_DIR}/3rdparty/stb CACHE PATH "Path where Stb image library can be located") set(CMAKE_DEBUG_POSTFIX d) set(CMAKE_THREAD_PREFER_PTHREAD ON) find_package(Threads REQUIRED) -if(MSVC) - find_package(PThreads_windows REQUIRED) +if(MSVC AND USE_INTEGRATED_LIBS) + find_package(PThreads4W REQUIRED) +elseif(MSVC) + find_package(pthreads REQUIRED) endif() if(ENABLE_OPENCV) find_package(OpenCV REQUIRED)