vcpkg/ports/libcaer/fix-libusb.diff
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

63 lines
1.7 KiB
Diff

diff --git a/cmakemod/libcaerConfig.cmake.in b/cmakemod/libcaerConfig.cmake.in
index cdf9f88..f0a17ba 100644
--- a/cmakemod/libcaerConfig.cmake.in
+++ b/cmakemod/libcaerConfig.cmake.in
@@ -21,6 +21,10 @@
CMAKE_POLICY(PUSH)
CMAKE_POLICY(VERSION 3.10)
+include(CMakeFindDependencyMacro)
+find_dependency(PkgConfig)
+pkg_check_modules(libusb REQUIRED IMPORTED_TARGET libusb-1.0)
+
INCLUDE(@PACKAGE_export_destination@/libcaer-exports.cmake)
SET(libcaer_INCLUDE_DIRS @PACKAGE_include_dirs@)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ce94a6..f03d7ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,16 +52,12 @@ MESSAGE(STATUS "Base libraries: ${BASE_LIBS}")
INCLUDE(FindPkgConfig)
# Required: basic USB devices support
-IF(CC_MSVC)
- FIND_PACKAGE(libusb CONFIG REQUIRED)
-ELSE()
- PKG_CHECK_MODULES(
- libusb
- REQUIRED
- IMPORTED_TARGET
- libusb-1.0>=1.0.17)
- SET(LIBCAER_PKGCONFIG_REQUIRES_PRIVATE "libusb-1.0 >= 1.0.17")
-ENDIF()
+PKG_CHECK_MODULES(
+ libusb
+ REQUIRED
+ IMPORTED_TARGET
+ libusb-1.0>=1.0.17)
+SET(LIBCAER_PKGCONFIG_REQUIRES_PRIVATE "libusb-1.0 >= 1.0.17")
# Optional: serial devices support
IF(ENABLE_SERIALDEV)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0ef4ac7..6f70a26 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -49,12 +49,11 @@ ENDIF()
IF(CC_MSVC)
LIST(APPEND LIBCAER_SOURCES ../thirdparty/simple-stdatomic/stdatomic.c)
- INCLUDE_DIRECTORIES(${LIBUSB_INCLUDE_DIRS})
- LIST(APPEND LIBCAER_LINK_LIBRARIES_PRIVATE ${LIBUSB_LIBRARIES})
-ELSE()
- LIST(APPEND LIBCAER_LINK_LIBRARIES_PRIVATE PkgConfig::libusb)
ENDIF()
+LIST(APPEND LIBCAER_LINK_LIBRARIES_PRIVATE PkgConfig::libusb)
+
+
# Set full RPATH
SET(CMAKE_INSTALL_RPATH ${USER_LOCAL_PREFIX}/${CMAKE_INSTALL_LIBDIR})