vcpkg/ports/libuvc/build_fix.patch
MonicaLiu 8abeb71402
[libusb] Fix usage (#35498)
* fix usage

* update version

* redo x64-windows.cmake

* resolve conflicts

* updaet git-tree

* fix downstream

* update version

* fix libirecovery

* update git-tree

* fix pkg_check_modules

* update git-tree

* fix libfreenect2

* update version

* fix libuvc

* update version

* fix libuvc patch

* update git-tree

* fix libuvc build_fix.patch

* update git-tree

* format

* update git-tree

* undo supports

* update git-tree

* fix azure-kinect-sensor-sdk

* update version

* add pkg-config.exe

* update git-tree

* disable build examples and tests

* update git-tree

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
2023-12-14 00:07:17 -08:00

46 lines
1.4 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fbaffc9..451b689 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,10 +39,11 @@ set(SOURCES
src/misc.c
)
-find_package(LibUSB)
+FIND_PACKAGE(PkgConfig REQUIRED)
+pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
# JpegPkg name to differ from shipped with CMake
-find_package(JpegPkg QUIET)
+find_package(JPEG REQUIRED)
if(JPEG_FOUND)
message(STATUS "Building libuvc with JPEG support.")
set(LIBUVC_HAS_JPEG TRUE)
@@ -116,7 +117,7 @@ foreach(target_name IN LISTS UVC_TARGETS)
)
target_link_libraries(${target_name}
# libusb-1.0 used internally so we link to it privately.
- PRIVATE LibUSB::LibUSB ${threads}
+ PRIVATE PkgConfig::libusb ${threads}
)
if(JPEG_FOUND)
target_link_libraries(${target_name}
diff --git a/libuvcConfig.cmake b/libuvcConfig.cmake
index b9887ea..c704ab5 100644
--- a/libuvcConfig.cmake
+++ b/libuvcConfig.cmake
@@ -10,8 +10,11 @@ if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
list(APPEND extraArgs REQUIRED)
endif()
-find_package(JpegPkg ${extraArgs})
-find_package(LibUSB ${extraArgs})
+include(CMakeFindDependencyMacro)
+find_dependency(JPEG ${extraArgs})
+find_dependency(Threads)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
include("${CMAKE_CURRENT_LIST_DIR}/libuvcTargets.cmake")
set(libuvc_FOUND TRUE)