From 84f2485a266d8d02891b1d5dac84269f3d0f6f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Mon, 9 Oct 2023 22:20:36 +0200 Subject: [PATCH] fixed #7099 - added optional `man` target to CMake / build manpage in CI (#5536) --- .github/workflows/buildman.yml | 20 ++++++++++++++++++++ CMakeLists.txt | 1 + cmake/options.cmake | 1 + cmake/printInfo.cmake | 1 + man/CMakeLists.txt | 7 +++++++ releasenotes.txt | 1 + 6 files changed, 31 insertions(+) create mode 100644 man/CMakeLists.txt diff --git a/.github/workflows/buildman.yml b/.github/workflows/buildman.yml index 9483bc0da..fde5cba00 100644 --- a/.github/workflows/buildman.yml +++ b/.github/workflows/buildman.yml @@ -37,3 +37,23 @@ jobs: with: name: output path: output + + manpage: + - runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Install missing software on ubuntu + if: contains(matrix.image, 'ubuntu') + run: | + apt-get update + apt-get install -y xsltproc docbook-xsl + + - name: build manpage + run: | + make man + + - uses: actions/upload-artifact@v3 + with: + name: cppcheck.1 + path: cppcheck.1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b76fbf81..34dd57867 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,5 +96,6 @@ add_subdirectory(test) # Tests add_subdirectory(gui) # Graphical application add_subdirectory(tools/triage) # Triage tool add_subdirectory(tools) +add_subdirectory(man) include(cmake/clang_tidy.cmake) diff --git a/cmake/options.cmake b/cmake/options.cmake index 47e3b0997..00b639de7 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -39,6 +39,7 @@ option(BUILD_TESTS "Build tests" option(REGISTER_TESTS "Register tests in CTest" ON) option(ENABLE_CHECK_INTERNAL "Enable internal checks" OFF) option(DISABLE_DMAKE "Disable run-dmake dependencies" OFF) +option(BUILD_MANPAGE "Enable man target to build manpage" OFF) option(BUILD_GUI "Build the qt application" OFF) option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF) diff --git a/cmake/printInfo.cmake b/cmake/printInfo.cmake index 97de22ee6..edef367f7 100644 --- a/cmake/printInfo.cmake +++ b/cmake/printInfo.cmake @@ -48,6 +48,7 @@ if(BUILD_TESTS) endif() message( STATUS "ENABLE_CHECK_INTERNAL = ${ENABLE_CHECK_INTERNAL}" ) message( STATUS "DISABLE_DMAKE = ${DISABLE_DMAKE}" ) +message( STATUS "BUILD_MANPAGE = ${BUILD_MANPAGE}" ) message( STATUS ) message( STATUS "BUILD_GUI = ${BUILD_GUI}" ) if (BUILD_GUI) diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt new file mode 100644 index 000000000..be9720d23 --- /dev/null +++ b/man/CMakeLists.txt @@ -0,0 +1,7 @@ +if (BUILD_MANPAGE) + find_program(XSLTPROC NAMES xsltproc REQUIRED) + set(DB2MAN "/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl") + set(MAN_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/cppcheck.1.xml") + add_custom_target(man ${XSLTPROC} --nonet --param man.charmap.use.subset "0" ${DB2MAN} ${MAN_SOURCE} + DEPENDS ${MAN_SOURCE}) +endif() \ No newline at end of file diff --git a/releasenotes.txt b/releasenotes.txt index 1299b31ad..dbecae7cf 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -23,3 +23,4 @@ Other: - Multiple "--project" options are now prohibited. These would have overlapped each other and lead to unexpected behavior. Please use separate runs with a single "--project" option instead. - "--project" can also no longer be used in conjunction with additional source files. - If a addon cannot be found it will bail out immediately instead of continously writing errors and failing the analysis at the end. +- Added CMake option "BUILD_MANPAGE" which adds the "man" target which will build the manpage. This requires xsltproc and the docbook XSLs to be installed.