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