SgPVSStudio.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #.rst:
  2. # SgPVSStudio
  3. # -----------
  4. #
  5. # PVS-Studio analysis.
  6. #
  7. # This script allows to check the library sources using the PVS-Studio,
  8. # offering more security for Sagui library users.
  9. # _
  10. # ___ __ _ __ _ _ _(_)
  11. # / __|/ _` |/ _` | | | | |
  12. # \__ \ (_| | (_| | |_| | |
  13. # |___/\__,_|\__, |\__,_|_|
  14. # |___/
  15. #
  16. # Cross-platform library which helps to develop web servers or frameworks.
  17. #
  18. # Copyright (C) 2016-2019 Silvio Clecio <[email protected]>
  19. #
  20. # Sagui library is free software; you can redistribute it and/or
  21. # modify it under the terms of the GNU Lesser General Public
  22. # License as published by the Free Software Foundation; either
  23. # version 2.1 of the License, or (at your option) any later version.
  24. #
  25. # Sagui library is distributed in the hope that it will be useful,
  26. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  28. # Lesser General Public License for more details.
  29. #
  30. # You should have received a copy of the GNU Lesser General Public
  31. # License along with Sagui library; if not, write to the Free Software
  32. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  33. #
  34. if(__SG_PVS_STUDIO_INCLUDED)
  35. return()
  36. endif()
  37. set(__SG_PVS_STUDIO_INCLUDED ON)
  38. option(SG_PVS_STUDIO "Enable PVS-Studio analysis" OFF)
  39. if(SG_PVS_STUDIO)
  40. include(PVS-Studio)
  41. if(NOT CMAKE_EXPORT_COMPILE_COMMANDS)
  42. set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  43. endif()
  44. include_directories(${SG_SOURCE_DIR})
  45. pvs_studio_add_target(
  46. TARGET pvs_studio_analysis ALL
  47. FORMAT fullhtml
  48. ANALYZE ${PROJECT_NAME}
  49. SOURCES ${SG_SOURCE} ${SG_TESTS_SOURCE}
  50. LOG pvs_studio_fullhtml)
  51. endif()