cmake: exclude -pthread from Emscripten default build
authorAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sat, 3 Jul 2021 10:57:18 +0000 (10:57 +0000)
committerAlexander Alekhin <alexander.a.alekhin@gmail.com>
Sat, 3 Jul 2021 11:13:28 +0000 (11:13 +0000)
cmake/OpenCVCompilerOptions.cmake

index 0a10bff..303d4f4 100644 (file)
@@ -177,7 +177,13 @@ if(CV_GCC OR CV_CLANG)
   endif()
 
   # We need pthread's
-  if(UNIX AND NOT ANDROID AND NOT (APPLE AND CV_CLANG)) # TODO
+  if((UNIX
+          AND NOT ANDROID
+          AND NOT (APPLE AND CV_CLANG)
+          AND NOT EMSCRIPTEN
+      )
+      OR (EMSCRIPTEN AND WITH_PTHREADS_PF)  # https://github.com/opencv/opencv/issues/20285
+  )
     add_extra_compiler_option(-pthread)
   endif()