9ab27fc924acdb26709bd59afa2d9137a17bc87b
[openwrt/staging/pepe2k.git] / tools / liblzo / patches / 001-add-cmake-ENABLE-configurables.patch
1 --- a/CMakeLists.txt 2022-11-28 06:34:39.171209779 -0800
2 +++ b/CMakeLists.txt 2022-11-28 06:33:13.368239757 -0800
3 @@ -51,8 +51,11 @@
4 project(lzo VERSION 2.10 LANGUAGES C)
5
6 # configuration options
7 -option(ENABLE_STATIC "Build static LZO library." ON)
8 -option(ENABLE_SHARED "Build shared LZO library." OFF)
9 +option(ENABLE_STATIC "Build static LZO library." ON)
10 +option(ENABLE_SHARED "Build shared LZO library." OFF)
11 +option(ENABLE_TESTS "Build tests." ON)
12 +option(ENABLE_EXAMPLES "Build examples." ON)
13 +option(ENABLE_DOCS "Install documentation." ON)
14 if(NOT ENABLE_STATIC AND NOT ENABLE_SHARED)
15 set(ENABLE_STATIC ON)
16 endif()
17 @@ -127,14 +130,20 @@
18 endif()
19 endmacro()
20 # main test driver
21 +if(ENABLE_TESTS OR ENABLE_EXAMPLES)
22 lzo_add_executable(lzotest lzotest/lzotest.c)
23 +endif()
24 # examples
25 +if(ENABLE_EXAMPLES)
26 lzo_add_executable(dict examples/dict.c)
27 lzo_add_executable(lzopack examples/lzopack.c)
28 lzo_add_executable(overlap examples/overlap.c)
29 lzo_add_executable(precomp examples/precomp.c)
30 lzo_add_executable(precomp2 examples/precomp2.c)
31 +endif()
32 +if(ENABLE_TESTS OR ENABLE_EXAMPLES)
33 lzo_add_executable(simple examples/simple.c)
34 +endif()
35 # some boring internal test programs
36 if(0)
37 lzo_add_executable(align tests/align.c)
38 @@ -144,7 +153,7 @@
39 endif()
40
41 # miniLZO
42 -if(1)
43 +if(ENABLE_TESTS)
44 add_executable(testmini minilzo/testmini.c minilzo/minilzo.c)
45 target_include_directories(testmini PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/lzo") # needed for "lzoconf.h"
46 endif()
47 @@ -263,8 +272,10 @@
48
49 if(DEFINED CMAKE_INSTALL_FULL_LIBDIR)
50
51 -set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT)
52 -install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
53 +if(ENABLE_DOCS)
54 + set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT)
55 + install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
56 +endif()
57
58 set(f include/lzo/lzo1.h include/lzo/lzo1a.h include/lzo/lzo1b.h
59 include/lzo/lzo1c.h include/lzo/lzo1f.h include/lzo/lzo1x.h
60 @@ -285,7 +296,7 @@
61 )
62 endif()
63
64 -if(1)
65 +if(ENABLE_EXAMPLES)
66 set(f lzopack lzotest simple testmini) # examples
67 install(TARGETS ${f} DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/lzo/examples")
68 endif()