Skip to content

Commit 01a0516

Browse files
committed
Enhance compatibility for building on Linux
1 parent cc0e4d3 commit 01a0516

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,15 @@ if(APPLE)
110110

111111
# Set pkg-config private libs for macOS
112112
set(PKG_CONFIG_LIBS_PRIVATE "Libs.private: -framework Foundation -framework AVFoundation -framework CoreVideo -framework CoreMedia -framework Accelerate")
113-
elseif(UNIX AND NOT APPLE)
114-
# Linux - no additional libraries needed for V4L2 as it's part of kernel
115-
set(PKG_CONFIG_LIBS_PRIVATE "")
113+
elseif(UNIX AND NOT APPLE AND NOT WIN32)
114+
# Linux – link pthread for std::thread support
115+
find_package(Threads REQUIRED)
116+
target_link_libraries(ccap PUBLIC Threads::Threads)
117+
118+
# Propagate to pkg-config for consumers
119+
set(PKG_CONFIG_LIBS_PRIVATE "Libs.private: -lpthread")
116120
else()
117-
# Windows or other platforms
121+
# Windows (including MinGW) or other platforms
118122
set(PKG_CONFIG_LIBS_PRIVATE "")
119123
endif()
120124

0 commit comments

Comments
 (0)