From a9e6bc630f7f241c503e4fe1e1189ed523feb2e6 Mon Sep 17 00:00:00 2001 From: qeqx <284521809+anon5376@users.noreply.github.com> Date: Sun, 11 Oct 2026 00:58:51 +0900 Subject: [PATCH] CMake: fix manpage installation from parent projects Resolve tommath.3 from LibTomMath's source directory when a parent project adds the library as a subdirectory. Exercise static and shared parent builds through installation in CI. Assisted-by: OpenAI GPT-6 (Codex) Assisted-by: OpenAI GPT-6 Luna --- .github/workflows/main.yml | 16 ++++++++++++++++ CMakeLists.txt | 2 +- demo/cmake_subproject/CMakeLists.txt | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 demo/cmake_subproject/CMakeLists.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3ed7061..447fb11f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -186,6 +186,22 @@ jobs: run: | make amalgamated_timing + CMake-subproject: + runs-on: ubuntu-22.04 + strategy: + matrix: + shared: [ 'Off', 'On' ] + steps: + - uses: actions/checkout@v4 + - name: build and install from a parent project + run: | + cmake -S demo/cmake_subproject -B build-subproject \ + -DBUILD_SHARED_LIBS=${{ matrix.shared }} -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX="$PWD/install-subproject" \ + -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON + cmake --build build-subproject --parallel 2 + cmake --install build-subproject + CMake: runs-on: ${{ matrix.os }} strategy: diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e722098..a173fcd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ write_basic_package_version_file( # Windows uses a different help sytem. if((NOT WIN32) AND (NOT CMAKE_HOST_WIN32)) # install manpage (not gzipped, some BSD's do not want it compressed?) -install(FILES ${CMAKE_SOURCE_DIR}/doc/tommath.3 +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/doc/tommath.3 DESTINATION ${CMAKE_INSTALL_MANDIR}/man3/ ) endif() diff --git a/demo/cmake_subproject/CMakeLists.txt b/demo/cmake_subproject/CMakeLists.txt new file mode 100644 index 00000000..fc22e327 --- /dev/null +++ b/demo/cmake_subproject/CMakeLists.txt @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: Unlicense + +cmake_minimum_required(VERSION 3.10) +project(libtommath_parent C) + +add_subdirectory(../.. libtommath)