Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / yajl / cmake-shared-static-fix.patch
blob05c8f19dacbceb45233224102a7a5268aa897903
1 From 768be8b9f98e30a8bd2d51576be9dfcf2cb838ea Mon Sep 17 00:00:00 2001
2 From: Kiskae <Kiskae@users.noreply.github.com>
3 Date: Tue, 26 Sep 2023 20:53:00 +0200
4 Subject: [PATCH] simplify compilation of static/shared with cmake
6 Signed-off-by: Kiskae <Kiskae@users.noreply.github.com>
7 ---
8 CMakeLists.txt | 2 ++
9 example/CMakeLists.txt | 2 +-
10 perf/CMakeLists.txt | 2 +-
11 src/CMakeLists.txt | 7 ++-----
12 test/parsing/CMakeLists.txt | 2 +-
13 5 files changed, 7 insertions(+), 8 deletions(-)
15 diff --git a/CMakeLists.txt b/CMakeLists.txt
16 index 471eee13..9af25203 100644
17 --- a/CMakeLists.txt
18 +++ b/CMakeLists.txt
19 @@ -16,6 +16,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
21 PROJECT(YetAnotherJSONParser C)
23 +option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
25 SET (YAJL_MAJOR 2)
26 SET (YAJL_MINOR 1)
27 SET (YAJL_MICRO 1)
28 diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
29 index 0a7f6220..62ddf14c 100644
30 --- a/example/CMakeLists.txt
31 +++ b/example/CMakeLists.txt
32 @@ -20,4 +20,4 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
34 ADD_EXECUTABLE(parse_config ${SRCS})
36 -TARGET_LINK_LIBRARIES(parse_config yajl_s)
37 +TARGET_LINK_LIBRARIES(parse_config yajl)
38 diff --git a/perf/CMakeLists.txt b/perf/CMakeLists.txt
39 index b438d7a1..924a2681 100644
40 --- a/perf/CMakeLists.txt
41 +++ b/perf/CMakeLists.txt
42 @@ -20,4 +20,4 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
44 ADD_EXECUTABLE(perftest ${SRCS})
46 -TARGET_LINK_LIBRARIES(perftest yajl_s)
47 +TARGET_LINK_LIBRARIES(perftest yajl)
48 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
49 index 789ddf99..78875032 100644
50 --- a/src/CMakeLists.txt
51 +++ b/src/CMakeLists.txt
52 @@ -35,9 +35,7 @@ SET (pkgconfigDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib/pkgconfig
53 # set the output path for libraries
54 SET(LIBRARY_OUTPUT_PATH ${libDir})
56 -ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS})
58 -ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
59 +ADD_LIBRARY(yajl ${SRCS} ${HDRS} ${PUB_HDRS})
61 #### setup shared library version number
62 SET_TARGET_PROPERTIES(yajl PROPERTIES
63 @@ -69,7 +67,7 @@ FOREACH (header ${PUB_HDRS})
65 EXEC_PROGRAM(${CMAKE_COMMAND} ARGS -E copy_if_different ${header} ${incDir})
67 - ADD_CUSTOM_COMMAND(TARGET yajl_s POST_BUILD
68 + ADD_CUSTOM_COMMAND(TARGET yajl POST_BUILD
69 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${header} ${incDir})
70 ENDFOREACH (header ${PUB_HDRS})
72 @@ -81,7 +79,6 @@ INSTALL(TARGETS yajl
73 RUNTIME DESTINATION lib${LIB_SUFFIX}
74 LIBRARY DESTINATION lib${LIB_SUFFIX}
75 ARCHIVE DESTINATION lib${LIB_SUFFIX})
76 -INSTALL(TARGETS yajl_s ARCHIVE DESTINATION lib${LIB_SUFFIX})
77 INSTALL(FILES ${PUB_HDRS} DESTINATION include/yajl)
78 INSTALL(FILES ${incDir}/yajl_version.h DESTINATION include/yajl)
79 INSTALL(FILES ${pkgconfigDir}/yajl.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig)
80 diff --git a/test/parsing/CMakeLists.txt b/test/parsing/CMakeLists.txt
81 index c22a3887..f445920d 100644
82 --- a/test/parsing/CMakeLists.txt
83 +++ b/test/parsing/CMakeLists.txt
84 @@ -20,4 +20,4 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../../${YAJL_DIST_NAME}/lib)
86 ADD_EXECUTABLE(yajl_test ${SRCS})
88 -TARGET_LINK_LIBRARIES(yajl_test yajl_s)
89 +TARGET_LINK_LIBRARIES(yajl_test yajl)