package An official xmake package repository
https://xrepo.xmake.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.5 KiB
84 lines
2.5 KiB
4 months ago
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 94e4292..7d0e142 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -169,27 +169,12 @@ endif()
|
||
|
|
||
|
|
||
|
if(MSVC)
|
||
|
- if((NOT CBOR_INCLUDE_DIRS) OR (NOT CBOR_LIBRARY_DIRS) OR
|
||
|
- (NOT CRYPTO_INCLUDE_DIRS) OR (NOT CRYPTO_LIBRARY_DIRS) OR
|
||
|
- (NOT ZLIB_INCLUDE_DIRS) OR (NOT ZLIB_LIBRARY_DIRS))
|
||
|
- message(FATAL_ERROR "please define "
|
||
|
- "{CBOR,CRYPTO,ZLIB}_{INCLUDE,LIBRARY}_DIRS when "
|
||
|
- "building under msvc")
|
||
|
- endif()
|
||
|
- if(BUILD_TESTS AND BUILD_SHARED_LIBS AND
|
||
|
- ((NOT CBOR_BIN_DIRS) OR (NOT ZLIB_BIN_DIRS) OR (NOT CRYPTO_BIN_DIRS)))
|
||
|
- message(FATAL_ERROR "please define {CBOR,CRYPTO,ZLIB}_BIN_DIRS "
|
||
|
- "when building tests")
|
||
|
- endif()
|
||
|
- if(NOT CBOR_LIBRARIES)
|
||
|
- set(CBOR_LIBRARIES cbor)
|
||
|
- endif()
|
||
|
- if(NOT ZLIB_LIBRARIES)
|
||
|
- set(ZLIB_LIBRARIES zlib1)
|
||
|
- endif()
|
||
|
- if(NOT CRYPTO_LIBRARIES)
|
||
|
- set(CRYPTO_LIBRARIES crypto)
|
||
|
- endif()
|
||
|
+ include(FindPkgConfig)
|
||
|
+ pkg_search_module(libcbor REQUIRED IMPORTED_TARGET libcbor)
|
||
|
+ find_package(OpenSSL REQUIRED)
|
||
|
+ find_package(ZLIB REQUIRED)
|
||
|
+ set(CBOR_LIBRARIES PkgConfig::libcbor)
|
||
|
+ set(CRYPTO_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||
|
|
||
|
set(MSVC_DISABLED_WARNINGS_LIST
|
||
|
"C4152" # nonstandard extension used: function/data pointer
|
||
|
@@ -218,26 +203,22 @@ if(MSVC)
|
||
|
set(NFC_LINUX OFF)
|
||
|
else()
|
||
|
include(FindPkgConfig)
|
||
|
- pkg_search_module(CBOR libcbor)
|
||
|
- pkg_search_module(CRYPTO libcrypto)
|
||
|
- pkg_search_module(ZLIB zlib)
|
||
|
+ pkg_search_module(libcbor REQUIRED IMPORTED_TARGET libcbor)
|
||
|
+ find_package(OpenSSL REQUIRED)
|
||
|
+ find_package(ZLIB REQUIRED)
|
||
|
|
||
|
if(NOT CBOR_FOUND AND NOT HAVE_CBOR_H)
|
||
|
- message(FATAL_ERROR "could not find libcbor")
|
||
|
+ # message(FATAL_ERROR "could not find libcbor")
|
||
|
endif()
|
||
|
if(NOT CRYPTO_FOUND AND NOT HAVE_OPENSSLV_H)
|
||
|
- message(FATAL_ERROR "could not find libcrypto")
|
||
|
+ # message(FATAL_ERROR "could not find libcrypto")
|
||
|
endif()
|
||
|
if(NOT ZLIB_FOUND)
|
||
|
message(FATAL_ERROR "could not find zlib")
|
||
|
endif()
|
||
|
|
||
|
- if(NOT CBOR_LIBRARIES)
|
||
|
- set(CBOR_LIBRARIES "cbor")
|
||
|
- endif()
|
||
|
- if(NOT CRYPTO_LIBRARIES)
|
||
|
- set(CRYPTO_LIBRARIES "crypto")
|
||
|
- endif()
|
||
|
+ set(CBOR_LIBRARIES PkgConfig::libcbor)
|
||
|
+ set(CRYPTO_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||
|
|
||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||
|
pkg_search_module(UDEV libudev REQUIRED)
|
||
|
@@ -277,8 +258,8 @@ else()
|
||
|
|
||
|
if(USE_HIDAPI)
|
||
|
add_definitions(-DUSE_HIDAPI)
|
||
|
- pkg_search_module(HIDAPI hidapi${HIDAPI_SUFFIX} REQUIRED)
|
||
|
- set(HIDAPI_LIBRARIES hidapi${HIDAPI_SUFFIX})
|
||
|
+ pkg_search_module(hidapi REQUIRED IMPORTED_TARGET hidapi)
|
||
|
+ set(HIDAPI_LIBRARIES PkgConfig::hidapi)
|
||
|
endif()
|
||
|
|
||
|
if(NFC_LINUX)
|