0001-CMakeLists.txt-honour-BUILD_TESTING.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From 15ec267520efbe45193eb1df5361a4ab56164294 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Sun, 8 May 2022 17:54:42 +0200
  4. Subject: [PATCH] CMakeLists.txt: honour BUILD_TESTING
  5. Allow the user to disable tests through the standard BUILD_TESTING
  6. option: https://cmake.org/cmake/help/latest/module/CTest.html
  7. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  8. [Retrieved from:
  9. https://github.com/rafaelsteil/libcgi/commit/15ec267520efbe45193eb1df5361a4ab56164294]
  10. ---
  11. CMakeLists.txt | 12 +++++++++---
  12. 1 file changed, 9 insertions(+), 3 deletions(-)
  13. diff --git a/CMakeLists.txt b/CMakeLists.txt
  14. index cbf0d97..e3329a1 100644
  15. --- a/CMakeLists.txt
  16. +++ b/CMakeLists.txt
  17. @@ -29,15 +29,21 @@ option(BUILD_SHARED_LIBS
  18. "Global flag to cause add_library to create shared libraries if on."
  19. ON
  20. )
  21. +option(BUILD_TESTING
  22. + "Build tests."
  23. + ON
  24. +)
  25. # subdirectories
  26. add_subdirectory("include/libcgi")
  27. add_subdirectory("src")
  28. # test
  29. -enable_testing()
  30. -include(CTest)
  31. -add_subdirectory("test")
  32. +if(BUILD_TESTING)
  33. + enable_testing()
  34. + include(CTest)
  35. + add_subdirectory("test")
  36. +endif(BUILD_TESTING)
  37. # cmake package stuff
  38. configure_package_config_file(${PROJECT_NAME_LC}-config.cmake.in