@@ -68,6 +68,24 @@ C-SDK 使用 [cURL](http://curl.haxx.se/) 进行网络相关操作。无论是
68
68
69
69
如果在项目构建过程中出现环境相关的编译错误和链接错误,请确认这些选项是否都已经正确配置,以及所依赖的库是否都已经正确的安装。
70
70
71
+ #### 通过 CMake 编译
72
+
73
+ 如果想在 CMake 项目里使用 C-SDK,可以直接在 CMake 里导入 C-SDK:
74
+
75
+ ``` cmake
76
+ INCLUDE(FetchContent)
77
+ FetchContent_Declare(
78
+ qiniu
79
+ GIT_REPOSITORY https://github.com/qiniu/c-sdk.git
80
+ GIT_TAG v7.8.0
81
+ )
82
+ FetchContent_MakeAvailable(qiniu)
83
+ FIND_PACKAGE(CURL REQUIRED)
84
+ FIND_PACKAGE(OpenSSL REQUIRED)
85
+ TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE qiniu m)
86
+ TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${CURL_LIBRARIES})
87
+ TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE ${OPENSSL_LIBRARIES})
88
+ ```
71
89
72
90
<a name =" appkey " ></a >
73
91
@@ -169,7 +187,7 @@ typedef struct _Qiniu_Error {
169
187
typedef struct _Qiniu_RS_StatRet {
170
188
const char* hash;
171
189
const char* mimeType;
172
- Qiniu_Int64 fsize;
190
+ Qiniu_Int64 fsize;
173
191
Qiniu_Int64 putTime;
174
192
} Qiniu_RS_StatRet;
175
193
```
@@ -427,7 +445,7 @@ void stat(Qiniu_Client* client, const char* bucket, const char* key)
427
445
typedef struct _Qiniu_RS_StatRet {
428
446
const char* hash;
429
447
const char* mimeType;
430
- Qiniu_Int64 fsize;
448
+ Qiniu_Int64 fsize;
431
449
Qiniu_Int64 putTime;
432
450
} Qiniu_RS_StatRet;
433
451
```
@@ -456,8 +474,8 @@ void delete(Qiniu_Client* client, const char* bucket, const char* key)
456
474
复制和移动操作,需要指定源路径和目标路径。
457
475
458
476
``` {c}
459
- void copy(Qiniu_Client* client,
460
- const char* bucketSrc, const char* keySrc,
477
+ void copy(Qiniu_Client* client,
478
+ const char* bucketSrc, const char* keySrc,
461
479
const char* bucketDest, const char* keyDest)
462
480
{
463
481
Qiniu_Error err = Qiniu_RS_Copy(client, bucketSrc, keySrc, bucketDest, keyDest);
@@ -470,8 +488,8 @@ void copy(Qiniu_Client* client,
470
488
```
471
489
472
490
``` {c}
473
- void move(Qiniu_Client* client,
474
- const char* bucketSrc, const char* keySrc,
491
+ void move(Qiniu_Client* client,
492
+ const char* bucketSrc, const char* keySrc,
475
493
const char* bucketDest, const char* keyDest)
476
494
{
477
495
Qiniu_Error err = Qiniu_RS_Move(client, bucketSrc, keySrc, bucketDest, keyDest);
@@ -494,7 +512,7 @@ void move(Qiniu_Client* client,
494
512
调用` Qiniu_RS_BatchStat ` 可以批量查看多个文件的属性信息。
495
513
496
514
``` {c}
497
- void batchStat(Qiniu_Client* client,
515
+ void batchStat(Qiniu_Client* client,
498
516
Qiniu_RS_EntryPath* entries, Qiniu_ItemCount entryCount)
499
517
{
500
518
Qiniu_RS_BatchStatRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchStatRet));
@@ -551,7 +569,7 @@ typedef struct _Qiniu_RS_BatchStatRet {
551
569
typedef struct _Qiniu_RS_StatRet {
552
570
const char* hash;
553
571
const char* mimeType;
554
- Qiniu_Int64 fsize;
572
+ Qiniu_Int64 fsize;
555
573
Qiniu_Int64 putTime;
556
574
} Qiniu_RS_StatRet;
557
575
```
@@ -563,7 +581,7 @@ typedef struct _Qiniu_RS_StatRet {
563
581
调用` Qiniu_RS_BatchDelete ` 可以批量删除多个文件。
564
582
565
583
``` {c}
566
- void batchDelete(Qiniu_Client* client,
584
+ void batchDelete(Qiniu_Client* client,
567
585
Qiniu_RS_EntryPath* entries, Qiniu_ItemCount entryCount)
568
586
{
569
587
Qiniu_RS_BatchItemRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchItemRet));
@@ -604,7 +622,7 @@ typedef struct _Qiniu_RS_BatchItemRet {
604
622
调用` Qiniu_RS_BatchCopy ` 可以批量复制多个文件。
605
623
606
624
``` {c}
607
- void batchCopy(Qiniu_Client* client,
625
+ void batchCopy(Qiniu_Client* client,
608
626
Qiniu_RS_EntryPathPair* entryPairs, Qiniu_ItemCount entryCount)
609
627
{
610
628
Qiniu_RS_BatchItemRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchItemRet));
@@ -644,7 +662,7 @@ typedef struct _Qiniu_RS_EntryPathPair {
644
662
批量移动和批量复制很类似,唯一的区别就是调用` Qiniu_RS_BatchMove ` 。
645
663
646
664
``` {c}
647
- void batchMove(Qiniu_Client* client,
665
+ void batchMove(Qiniu_Client* client,
648
666
Qiniu_RS_EntryPathPair* entryPairs, Qiniu_ItemCount entryCount)
649
667
{
650
668
Qiniu_RS_BatchItemRet* rets = calloc(entryCount, sizeof(Qiniu_RS_BatchItemRet));
0 commit comments