Removed
Link Here
|
1 |
Obtained from: https://github.com/json-c/json-c/commit/8b511c402b73d1d8b195991891c8d44859cb57ec |
2 |
https://github.com/json-c/json-c/commit/22870ac2bd4cfdd135887ecc8cbbe02e7ef0c34e |
3 |
https://github.com/json-c/json-c/commit/4f43a077a497f94214645ce9763247ec085e2094 |
4 |
|
5 |
--- CMakeLists.txt.orig 2020-04-19 03:39:09 UTC |
6 |
+++ CMakeLists.txt |
7 |
@@ -65,6 +65,7 @@ include(GNUInstallDirs) |
8 |
include(CMakePackageConfigHelpers) |
9 |
|
10 |
option(BUILD_SHARED_LIBS "Default to building shared libraries" ON) |
11 |
+option(BUILD_STATIC_LIBS "Default to building static libraries" ON) |
12 |
|
13 |
# Generate a release merge and test it to verify the correctness of republishing the package. |
14 |
ADD_CUSTOM_TARGET(distcheck |
15 |
@@ -299,7 +300,7 @@ if ($ENV{VALGRIND}) |
16 |
endif() |
17 |
|
18 |
set(JSON_C_PUBLIC_HEADERS |
19 |
- ${PROJECT_BINARY_DIR}/config.h |
20 |
+ # Note: config.h is _not_ included here |
21 |
${PROJECT_BINARY_DIR}/json_config.h |
22 |
|
23 |
${PROJECT_SOURCE_DIR}/json.h |
24 |
@@ -383,7 +384,7 @@ add_library(${PROJECT_NAME} |
25 |
set_target_properties(${PROJECT_NAME} PROPERTIES |
26 |
VERSION 5.0.0 |
27 |
SOVERSION 5) |
28 |
- |
29 |
+list(APPEND CMAKE_TARGETS ${PROJECT_NAME}) |
30 |
# If json-c is used as subroject it set to target correct interface -I flags and allow |
31 |
# to build external target without extra include_directories(...) |
32 |
target_include_directories(${PROJECT_NAME} |
33 |
@@ -392,7 +393,22 @@ target_include_directories(${PROJECT_NAME} |
34 |
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> |
35 |
) |
36 |
|
37 |
-install(TARGETS ${PROJECT_NAME} |
38 |
+# Allow to build static and shared libraries at the same time |
39 |
+if (BUILD_STATIC_LIBS AND BUILD_SHARED_LIBS) |
40 |
+ set(STATIC_LIB ${PROJECT_NAME}-static) |
41 |
+ add_library(${STATIC_LIB} STATIC |
42 |
+ ${JSON_C_SOURCES} |
43 |
+ ${JSON_C_HEADERS} |
44 |
+ ) |
45 |
+ |
46 |
+ # rename the static library |
47 |
+ set_target_properties(${STATIC_LIB} PROPERTIES |
48 |
+ OUTPUT_NAME ${PROJECT_NAME} |
49 |
+ ) |
50 |
+ list(APPEND CMAKE_TARGETS ${STATIC_LIB}) |
51 |
+endif () |
52 |
+ |
53 |
+install(TARGETS ${CMAKE_TARGETS} |
54 |
EXPORT ${PROJECT_NAME}-targets |
55 |
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
56 |
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |