Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party CJSON
提交
2a087843
T
Third Party CJSON
项目概览
OpenHarmony
/
Third Party CJSON
大约 1 年 前同步成功
通知
6
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party CJSON
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a087843
编写于
11月 28, 2017
作者:
M
Max Bruckner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add overrides for BUILD_SHARED_LIBS
上级
eb7c681a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
3 deletion
+13
-3
CMakeLists.txt
CMakeLists.txt
+11
-2
README.md
README.md
+1
-0
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
2a087843
...
...
@@ -123,9 +123,18 @@ file(GLOB HEADERS cJSON.h)
set
(
SOURCES cJSON.c
)
option
(
BUILD_SHARED_AND_STATIC_LIBS
"Build both shared and static libraries"
Off
)
option
(
CJSON_OVERRIDE_BUILD_SHARED_LIBS
"Override BUILD_SHARED_LIBS with CJSON_BUILD_SHARED_LIBS"
OFF
)
option
(
CJSON_BUILD_SHARED_LIBS
"Overrides BUILD_SHARED_LIBS if CJSON_OVERRIDE_BUILD_SHARED_LIBS is enabled"
ON
)
if
((
CJSON_OVERRIDE_BUILD_SHARED_LIBS AND CJSON_BUILD_SHARED_LIBS
)
OR
((
NOT CJSON_OVERRIDE_BUILD_SHARED_LIBS
)
AND BUILD_SHARED_LIBS
))
set
(
CJSON_LIBRARY_TYPE SHARED
)
else
()
set
(
CJSON_LIBRARY_TYPE STATIC
)
endif
()
if
(
NOT BUILD_SHARED_AND_STATIC_LIBS
)
add_library
(
"
${
CJSON_LIB
}
"
"
${
HEADERS
}
"
"
${
SOURCES
}
"
)
add_library
(
"
${
CJSON_LIB
}
"
"
${
CJSON_LIBRARY_TYPE
}
"
"
${
HEADERS
}
"
"
${
SOURCES
}
"
)
else
()
# See https://cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F
add_library
(
"
${
CJSON_LIB
}
"
SHARED
"
${
HEADERS
}
"
"
${
SOURCES
}
"
)
...
...
@@ -165,7 +174,7 @@ if(ENABLE_CJSON_UTILS)
set
(
SOURCES_UTILS cJSON_Utils.c
)
if
(
NOT BUILD_SHARED_AND_STATIC_LIBS
)
add_library
(
"
${
CJSON_UTILS_LIB
}
"
"
${
HEADERS_UTILS
}
"
"
${
SOURCES_UTILS
}
"
)
add_library
(
"
${
CJSON_UTILS_LIB
}
"
"
${
CJSON_LIBRARY_TYPE
}
"
"
${
HEADERS_UTILS
}
"
"
${
SOURCES_UTILS
}
"
)
target_link_libraries
(
"
${
CJSON_UTILS_LIB
}
"
"
${
CJSON_LIB
}
"
)
else
()
add_library
(
"
${
CJSON_UTILS_LIB
}
"
SHARED
"
${
HEADERS_UTILS
}
"
"
${
SOURCES_UTILS
}
"
)
...
...
README.md
浏览文件 @
2a087843
...
...
@@ -94,6 +94,7 @@ You can change the build process with a list of different options that you can p
*
`-DBUILD_SHARED_AND_STATIC_LIBS=On`
: Build both shared and static libraries. (off by default)
*
`-DCMAKE_INSTALL_PREFIX=/usr`
: Set a prefix for the installation.
*
`-DENABLE_LOCALES=On`
: Enable the usage of localeconv method. ( on by default )
*
`-DCJSON_OVERRIDE_BUILD_SHARED_LIBS=On`
: Enable overriding the value of
`BUILD_SHARED_LIBS`
with
`-DCJSON_BUILD_SHARED_LIBS`
.
If you are packaging cJSON for a distribution of Linux, you would probably take these steps for example:
```
...
...
tests/CMakeLists.txt
浏览文件 @
2a087843
if
(
ENABLE_CJSON_TEST
)
add_library
(
unity unity/src/unity.c
)
add_library
(
unity
"
${
CJSON_LIBRARY_TYPE
}
"
unity/src/unity.c
)
# Disable -Werror for Unity
if
(
FLAG_SUPPORTED_Werror
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录