001-add-cmake-ENABLE-configurables.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. # configuration options
  6. -option(ENABLE_STATIC "Build static LZO library." ON)
  7. -option(ENABLE_SHARED "Build shared LZO library." OFF)
  8. +option(ENABLE_STATIC "Build static LZO library." ON)
  9. +option(ENABLE_SHARED "Build shared LZO library." OFF)
  10. +option(ENABLE_TESTS "Build tests." ON)
  11. +option(ENABLE_EXAMPLES "Build examples." ON)
  12. +option(ENABLE_DOCS "Install documentation." ON)
  13. if(NOT ENABLE_STATIC AND NOT ENABLE_SHARED)
  14. set(ENABLE_STATIC ON)
  15. endif()
  16. @@ -127,14 +130,20 @@
  17. endif()
  18. endmacro()
  19. # main test driver
  20. +if(ENABLE_TESTS OR ENABLE_EXAMPLES)
  21. lzo_add_executable(lzotest lzotest/lzotest.c)
  22. +endif()
  23. # examples
  24. +if(ENABLE_EXAMPLES)
  25. lzo_add_executable(dict examples/dict.c)
  26. lzo_add_executable(lzopack examples/lzopack.c)
  27. lzo_add_executable(overlap examples/overlap.c)
  28. lzo_add_executable(precomp examples/precomp.c)
  29. lzo_add_executable(precomp2 examples/precomp2.c)
  30. +endif()
  31. +if(ENABLE_TESTS OR ENABLE_EXAMPLES)
  32. lzo_add_executable(simple examples/simple.c)
  33. +endif()
  34. # some boring internal test programs
  35. if(0)
  36. lzo_add_executable(align tests/align.c)
  37. @@ -144,7 +153,7 @@
  38. endif()
  39. # miniLZO
  40. -if(1)
  41. +if(ENABLE_TESTS)
  42. add_executable(testmini minilzo/testmini.c minilzo/minilzo.c)
  43. target_include_directories(testmini PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/lzo") # needed for "lzoconf.h"
  44. endif()
  45. @@ -263,8 +272,10 @@
  46. if(DEFINED CMAKE_INSTALL_FULL_LIBDIR)
  47. -set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT)
  48. -install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
  49. +if(ENABLE_DOCS)
  50. + set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT)
  51. + install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
  52. +endif()
  53. set(f include/lzo/lzo1.h include/lzo/lzo1a.h include/lzo/lzo1b.h
  54. include/lzo/lzo1c.h include/lzo/lzo1f.h include/lzo/lzo1x.h
  55. @@ -285,7 +296,7 @@
  56. )
  57. endif()
  58. -if(1)
  59. +if(ENABLE_EXAMPLES)
  60. set(f lzopack lzotest simple testmini) # examples
  61. install(TARGETS ${f} DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/lzo/examples")
  62. endif()