From 7d02e8b4b890e5cb4d398edd41129498285af188 Mon Sep 17 00:00:00 2001 From: Aleksandr Kovalko Date: Thu, 7 May 2026 18:46:59 +0200 Subject: [PATCH 1/5] Rename package to geo-utils-cpp (repology name conflict) --- .github/workflows/ci.yml | 2 +- .github/workflows/coverage.yml | 4 +- .github/workflows/install.yml | 2 +- CHANGELOG.md | 28 +++++++ CMakeLists.txt | 84 +++++++++---------- README.md | 32 +++---- cmake/GeoUtilsConfig.cmake.in | 5 -- cmake/GeoUtilsCppConfig.cmake.in | 5 ++ .../{geo-utils.pc.in => geo-utils-cpp.pc.in} | 4 +- docs/getting-started.md | 18 ++-- examples/CMakeLists.txt | 2 +- tests/consumer/CMakeLists.txt | 6 +- tests/consumer/main.cpp | 2 +- 13 files changed, 111 insertions(+), 83 deletions(-) delete mode 100644 cmake/GeoUtilsConfig.cmake.in create mode 100644 cmake/GeoUtilsCppConfig.cmake.in rename cmake/{geo-utils.pc.in => geo-utils-cpp.pc.in} (75%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0038e98..4b91f71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: key: ${{ runner.os }}-${{ matrix.name }}-googletest-1.14.0 - name: Configure - run: cmake -S . -B build -DGEO_UTILS_BUILD_TESTS=ON -DGEO_UTILS_BUILD_EXAMPLES=ON + run: cmake -S . -B build -DGEO_UTILS_CPP_BUILD_TESTS=ON -DGEO_UTILS_CPP_BUILD_EXAMPLES=ON - name: Build run: cmake --build build --config Release diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3ba41eb..c09b210 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -4,7 +4,7 @@ # then generates a Cobertura-XML report scoped to include/ (the public headers). # The report is uploaded to Codecov for tracking over time. # -# Linux-only: relies on gcc + gcov; the GEO_UTILS_ENABLE_COVERAGE option in CMakeLists.txt +# Linux-only: relies on gcc + gcov; the GEO_UTILS_CPP_ENABLE_COVERAGE option in CMakeLists.txt # is GCC/Clang-specific. # # Triggered automatically on push/PR to master/main; can also be run manually @@ -42,7 +42,7 @@ jobs: run: pip install gcovr - name: Configure - run: cmake -S . -B build -DGEO_UTILS_BUILD_TESTS=ON -DGEO_UTILS_ENABLE_COVERAGE=ON + run: cmake -S . -B build -DGEO_UTILS_CPP_BUILD_TESTS=ON -DGEO_UTILS_CPP_ENABLE_COVERAGE=ON - name: Build run: cmake --build build diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 440935e..6c03ec7 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -2,7 +2,7 @@ # # Installs the library to a temporary prefix, then configures and builds a # minimal consumer project (tests/consumer/) against that prefix using -# `find_package(GeoUtils 1.0 REQUIRED)` and `target_link_libraries(... geo::utils)`. +# `find_package(GeoUtilsCpp 1.0 REQUIRED)` and `target_link_libraries(... geo::utils)`. # Runs the consumer to verify end-to-end integration. # # Catches regressions in install paths, exported target names, and diff --git a/CHANGELOG.md b/CHANGELOG.md index a2e9b66..bac3a99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## v1.0.1 + +Renamed package to `geo-utils-cpp` to avoid a name collision with an existing +`geo-utils` component on [repology](https://repology.org). The public C++ API +is unchanged — downstream source code does not need to be updated. + +### Changed + +- pkg-config name: `geo-utils` → `geo-utils-cpp` (`.pc` file installed as + `geo-utils-cpp.pc`). +- CPack package name: `geo-utils` → `geo-utils-cpp`. +- CMake package name: `find_package(GeoUtils ...)` → `find_package(GeoUtilsCpp ...)`. + Config files install to `${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtilsCpp/` as + `GeoUtilsCppConfig.cmake`, `GeoUtilsCppConfigVersion.cmake`, and + `GeoUtilsCppTargets.cmake`. +- Build options renamed with `GEO_UTILS_CPP_` prefix: + `GEO_UTILS_BUILD_TESTS` → `GEO_UTILS_CPP_BUILD_TESTS`, + `GEO_UTILS_BUILD_EXAMPLES` → `GEO_UTILS_CPP_BUILD_EXAMPLES`, + `GEO_UTILS_ENABLE_COVERAGE` → `GEO_UTILS_CPP_ENABLE_COVERAGE`, + `GEO_UTILS_INSTALL_PKGCONFIG` → `GEO_UTILS_CPP_INSTALL_PKGCONFIG`. + +### Unchanged (downstream-compatible) + +- Imported target `geo::utils`. +- C++ namespace `geo::` and `geo::detail::`. +- Public headers: ``, ``, ``, + ``. + ## v1.0.0 Initial stable release. Header-only C++17 library for spherical geographic diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a836a8..ff17178 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,34 +1,34 @@ cmake_minimum_required(VERSION 3.14) -project(GeoUtils VERSION 1.0.0 LANGUAGES CXX) +project(GeoUtilsCpp VERSION 1.0.1 LANGUAGES CXX) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) - set(_geo_utils_is_top_level ON) + set(_geo_utils_cpp_is_top_level ON) else() - set(_geo_utils_is_top_level OFF) + set(_geo_utils_cpp_is_top_level OFF) endif() include(CMakeDependentOption) -option(GEO_UTILS_BUILD_TESTS "Build geo-utils tests" ${_geo_utils_is_top_level}) -option(GEO_UTILS_BUILD_EXAMPLES "Build geo-utils examples" ${_geo_utils_is_top_level}) -cmake_dependent_option(GEO_UTILS_ENABLE_COVERAGE +option(GEO_UTILS_CPP_BUILD_TESTS "Build geo-utils-cpp tests" ${_geo_utils_cpp_is_top_level}) +option(GEO_UTILS_CPP_BUILD_EXAMPLES "Build geo-utils-cpp examples" ${_geo_utils_cpp_is_top_level}) +cmake_dependent_option(GEO_UTILS_CPP_ENABLE_COVERAGE "Enable gcov coverage instrumentation (GCC/Clang only)" OFF - "GEO_UTILS_BUILD_TESTS" OFF) + "GEO_UTILS_CPP_BUILD_TESTS" OFF) # Header-only interface target -add_library(geo_utils INTERFACE) -add_library(geo::utils ALIAS geo_utils) +add_library(geo_utils_cpp INTERFACE) +add_library(geo::utils ALIAS geo_utils_cpp) # So the exported imported target is geo::utils (matches the build-tree alias) -set_target_properties(geo_utils PROPERTIES EXPORT_NAME utils) +set_target_properties(geo_utils_cpp PROPERTIES EXPORT_NAME utils) -target_include_directories(geo_utils INTERFACE +target_include_directories(geo_utils_cpp INTERFACE $ $ ) -target_compile_features(geo_utils INTERFACE cxx_std_17) +target_compile_features(geo_utils_cpp INTERFACE cxx_std_17) # Tests -if(GEO_UTILS_BUILD_TESTS) +if(GEO_UTILS_CPP_BUILD_TESTS) include(CTest) include(GoogleTest) @@ -65,13 +65,13 @@ if(GEO_UTILS_BUILD_TESTS) endif() endif() - add_executable(geo_utils_tests tests/tests.cpp) - target_link_libraries(geo_utils_tests + add_executable(geo_utils_cpp_tests tests/tests.cpp) + target_link_libraries(geo_utils_cpp_tests PRIVATE geo::utils GTest::GTest GTest::Main ) - gtest_discover_tests(geo_utils_tests) + gtest_discover_tests(geo_utils_cpp_tests) - if(GEO_UTILS_ENABLE_COVERAGE) + if(GEO_UTILS_CPP_ENABLE_COVERAGE) # `--coverage` is split: compile inserts gcov hooks, link pulls in the # gcov runtime. The compiler-flag check must include both stages — see # CMAKE_REQUIRED_LINK_OPTIONS (CMake 3.14+). Otherwise the test object @@ -79,22 +79,22 @@ if(GEO_UTILS_BUILD_TESTS) # negative on toolchains that actually support the flag (e.g. AppleClang). include(CheckCXXCompilerFlag) set(CMAKE_REQUIRED_LINK_OPTIONS --coverage) - check_cxx_compiler_flag(--coverage GEO_UTILS_HAS_COVERAGE_FLAG) + check_cxx_compiler_flag(--coverage GEO_UTILS_CPP_HAS_COVERAGE_FLAG) unset(CMAKE_REQUIRED_LINK_OPTIONS) - if(NOT GEO_UTILS_HAS_COVERAGE_FLAG) + if(NOT GEO_UTILS_CPP_HAS_COVERAGE_FLAG) message(FATAL_ERROR - "GEO_UTILS_ENABLE_COVERAGE=ON requested, but the C++ compiler " + "GEO_UTILS_CPP_ENABLE_COVERAGE=ON requested, but the C++ compiler " "(${CMAKE_CXX_COMPILER_ID}) does not support --coverage. " "Coverage instrumentation requires GCC or Clang.") endif() - target_compile_options(geo_utils_tests PRIVATE --coverage) - target_link_options(geo_utils_tests PRIVATE --coverage) + target_compile_options(geo_utils_cpp_tests PRIVATE --coverage) + target_link_options(geo_utils_cpp_tests PRIVATE --coverage) endif() endif() # Examples -if(GEO_UTILS_BUILD_EXAMPLES) +if(GEO_UTILS_CPP_BUILD_EXAMPLES) add_subdirectory(examples) endif() @@ -104,48 +104,48 @@ include(GNUInstallDirs) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -install(TARGETS geo_utils - EXPORT GeoUtilsTargets +install(TARGETS geo_utils_cpp + EXPORT GeoUtilsCppTargets ) -install(EXPORT GeoUtilsTargets - FILE GeoUtilsTargets.cmake +install(EXPORT GeoUtilsCppTargets + FILE GeoUtilsCppTargets.cmake NAMESPACE geo:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtils + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtilsCpp ) include(CMakePackageConfigHelpers) configure_package_config_file( - cmake/GeoUtilsConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsConfig.cmake - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtils + cmake/GeoUtilsCppConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsCppConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtilsCpp ) write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsCppConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion ) install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsConfigVersion.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtils + ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsCppConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/GeoUtilsCppConfigVersion.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GeoUtilsCpp ) # pkg-config -option(GEO_UTILS_INSTALL_PKGCONFIG "Install a pkg-config (.pc) file" ON) -if(GEO_UTILS_INSTALL_PKGCONFIG) +option(GEO_UTILS_CPP_INSTALL_PKGCONFIG "Install a pkg-config (.pc) file" ON) +if(GEO_UTILS_CPP_INSTALL_PKGCONFIG) configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/geo-utils.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/geo-utils.pc + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/geo-utils-cpp.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/geo-utils-cpp.pc @ONLY ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geo-utils.pc + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/geo-utils-cpp.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) endif() -if(_geo_utils_is_top_level) - set(CPACK_PACKAGE_NAME "geo-utils") +if(_geo_utils_cpp_is_top_level) + set(CPACK_PACKAGE_NAME "geo-utils-cpp") set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") set(CPACK_GENERATOR "ZIP") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") diff --git a/README.md b/README.md index 4b6a87b..70e988b 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# geo-utils +# geo-utils-cpp

- - CI + + CI - + Code quality - - Coverage + + Coverage - - Release + + Release

@@ -27,8 +27,8 @@ Supported platforms - - License + + License

@@ -64,11 +64,11 @@ Uses spherical Earth approximation (like Google Maps). include(FetchContent) FetchContent_Declare( - GeoUtils - GIT_REPOSITORY https://github.com/gistrec/geo-utils.git - GIT_TAG v1.0.0 + GeoUtilsCpp + GIT_REPOSITORY https://github.com/gistrec/geo-utils-cpp.git + GIT_TAG v1.0.1 ) -FetchContent_MakeAvailable(GeoUtils) +FetchContent_MakeAvailable(GeoUtilsCpp) target_link_libraries(your_target PRIVATE geo::utils) ``` @@ -76,7 +76,7 @@ target_link_libraries(your_target PRIVATE geo::utils) ### find_package ```cmake -find_package(GeoUtils 1.0 REQUIRED) +find_package(GeoUtilsCpp 1.0 REQUIRED) target_link_libraries(your_target PRIVATE geo::utils) ``` @@ -111,7 +111,7 @@ See [docs/api.md](docs/api.md) for the full API reference. ## Support -[Please open an issue on GitHub](https://github.com/gistrec/geo-utils/issues) +[Please open an issue on GitHub](https://github.com/gistrec/geo-utils-cpp/issues) ## License diff --git a/cmake/GeoUtilsConfig.cmake.in b/cmake/GeoUtilsConfig.cmake.in deleted file mode 100644 index 61e1eec..0000000 --- a/cmake/GeoUtilsConfig.cmake.in +++ /dev/null @@ -1,5 +0,0 @@ -@PACKAGE_INIT@ - -include("${CMAKE_CURRENT_LIST_DIR}/GeoUtilsTargets.cmake") - -check_required_components(GeoUtils) diff --git a/cmake/GeoUtilsCppConfig.cmake.in b/cmake/GeoUtilsCppConfig.cmake.in new file mode 100644 index 0000000..066cd95 --- /dev/null +++ b/cmake/GeoUtilsCppConfig.cmake.in @@ -0,0 +1,5 @@ +@PACKAGE_INIT@ + +include("${CMAKE_CURRENT_LIST_DIR}/GeoUtilsCppTargets.cmake") + +check_required_components(GeoUtilsCpp) diff --git a/cmake/geo-utils.pc.in b/cmake/geo-utils-cpp.pc.in similarity index 75% rename from cmake/geo-utils.pc.in rename to cmake/geo-utils-cpp.pc.in index b0d511e..6e38633 100644 --- a/cmake/geo-utils.pc.in +++ b/cmake/geo-utils-cpp.pc.in @@ -2,8 +2,8 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} includedir=${prefix}/@CMAKE_INSTALL_FULL_INCLUDEDIR@ -Name: geo-utils +Name: geo-utils-cpp Description: Header-only C++ geographic utilities -URL: https://github.com/gistrec/geo-utils +URL: https://github.com/gistrec/geo-utils-cpp Version: @PROJECT_VERSION@ Cflags: -I${includedir} diff --git a/docs/getting-started.md b/docs/getting-started.md index 016b6d7..73ea710 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -13,11 +13,11 @@ include(FetchContent) FetchContent_Declare( - GeoUtils - GIT_REPOSITORY https://github.com/gistrec/geo-utils.git - GIT_TAG v1.0.0 + GeoUtilsCpp + GIT_REPOSITORY https://github.com/gistrec/geo-utils-cpp.git + GIT_TAG v1.0.1 ) -FetchContent_MakeAvailable(GeoUtils) +FetchContent_MakeAvailable(GeoUtilsCpp) target_link_libraries(your_target PRIVATE geo::utils) ``` @@ -27,7 +27,7 @@ target_link_libraries(your_target PRIVATE geo::utils) Install the library first, then: ```cmake -find_package(GeoUtils 1.0 REQUIRED) +find_package(GeoUtilsCpp 1.0 REQUIRED) target_link_libraries(your_target PRIVATE geo::utils) ``` @@ -36,7 +36,7 @@ target_link_libraries(your_target PRIVATE geo::utils) Copy the `include/` directory into your project and add it to your compiler's include path: ```sh -g++ main.cpp -std=c++17 -I/path/to/geo-utils/include -o main +g++ main.cpp -std=c++17 -I/path/to/geo-utils-cpp/include -o main ``` ## Usage @@ -114,9 +114,9 @@ int main() { ## Build options -- `GEO_UTILS_BUILD_TESTS` — build unit tests (default: ON if top-level, OFF otherwise) -- `GEO_UTILS_BUILD_EXAMPLES` — build examples (default: ON if top-level, OFF otherwise) -- `GEO_UTILS_ENABLE_COVERAGE` — gcov instrumentation, GCC/Clang only (default: OFF) +- `GEO_UTILS_CPP_BUILD_TESTS` — build unit tests (default: ON if top-level, OFF otherwise) +- `GEO_UTILS_CPP_BUILD_EXAMPLES` — build examples (default: ON if top-level, OFF otherwise) +- `GEO_UTILS_CPP_ENABLE_COVERAGE` — gcov instrumentation, GCC/Clang only (default: OFF) ## Building and testing diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9485e1b..8ab9759 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,7 +1,7 @@ foreach(example spherical poly) add_executable(example_${example} ${example}.cpp) target_link_libraries(example_${example} PRIVATE geo::utils) - if(GEO_UTILS_BUILD_TESTS) + if(GEO_UTILS_CPP_BUILD_TESTS) add_test(NAME example_${example} COMMAND example_${example}) endif() endforeach() diff --git a/tests/consumer/CMakeLists.txt b/tests/consumer/CMakeLists.txt index 6d4d1ab..a366f08 100644 --- a/tests/consumer/CMakeLists.txt +++ b/tests/consumer/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.14) -project(geo_utils_consumer LANGUAGES CXX) +project(geo_utils_cpp_consumer LANGUAGES CXX) -# Smoke test for an installed geo-utils package: locate it via find_package, +# Smoke test for an installed geo-utils-cpp package: locate it via find_package, # link against geo::utils, and run a minimal program. Intended to be configured # against an install prefix from the install workflow. -find_package(GeoUtils 1.0 REQUIRED) +find_package(GeoUtilsCpp 1.0 REQUIRED) add_executable(app main.cpp) target_link_libraries(app PRIVATE geo::utils) diff --git a/tests/consumer/main.cpp b/tests/consumer/main.cpp index 143845c..89a64e1 100644 --- a/tests/consumer/main.cpp +++ b/tests/consumer/main.cpp @@ -1,4 +1,4 @@ -// Smoke test for an installed geo-utils package. +// Smoke test for an installed geo-utils-cpp package. // Verifies that is reachable, geo::utils target links, and // the basic public API produces a sensible result. From ea3d0e03d23097282ddd7c35e4e5865923d5f85f Mon Sep 17 00:00:00 2001 From: Aleksandr Kovalko Date: Thu, 7 May 2026 20:31:12 +0200 Subject: [PATCH 2/5] Address review feedback: fix .pc includedir, bump find_package to 1.0.1 --- .github/workflows/install.yml | 17 +++++++++++++++++ CMakeLists.txt | 10 +++++----- README.md | 2 +- cmake/geo-utils-cpp.pc.in | 2 +- docs/getting-started.md | 2 +- tests/consumer/CMakeLists.txt | 2 +- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 6c03ec7..35c6ea6 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -50,6 +50,23 @@ jobs: - name: Install library run: cmake --install build --config Release --prefix ${{ runner.temp }}/prefix + # pkg-config sanity: catches regressions in the .pc template (e.g. a + # malformed includedir that would expand into a doubled absolute path). + # Skipped on Windows — pkg-config isn't part of the default toolchain. + - name: Verify pkg-config metadata + if: runner.os != 'Windows' + env: + PKG_CONFIG_PATH: ${{ runner.temp }}/prefix/lib/pkgconfig + run: | + version=$(pkg-config --modversion geo-utils-cpp) + cflags=$(pkg-config --cflags geo-utils-cpp) + echo "version: $version" + echo "cflags: $cflags" + test "$version" = "1.0.1" + case "$cflags" in + *//*) echo "ERROR: doubled-slash in include path: $cflags" >&2; exit 1 ;; + esac + - name: Configure consumer run: cmake -S tests/consumer -B build-consumer -DCMAKE_PREFIX_PATH=${{ runner.temp }}/prefix diff --git a/CMakeLists.txt b/CMakeLists.txt index ff17178..a55b6d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,10 +144,10 @@ if(GEO_UTILS_CPP_INSTALL_PKGCONFIG) ) endif() -if(_geo_utils_cpp_is_top_level) +if(_geo_utils_cpp_is_top_level) set(CPACK_PACKAGE_NAME "geo-utils-cpp") - set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") - set(CPACK_GENERATOR "ZIP") - set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") - include(CPack) + set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}") + set(CPACK_GENERATOR "ZIP") + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") + include(CPack) endif() diff --git a/README.md b/README.md index 70e988b..6d55be6 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ target_link_libraries(your_target PRIVATE geo::utils) ### find_package ```cmake -find_package(GeoUtilsCpp 1.0 REQUIRED) +find_package(GeoUtilsCpp 1.0.1 REQUIRED) target_link_libraries(your_target PRIVATE geo::utils) ``` diff --git a/cmake/geo-utils-cpp.pc.in b/cmake/geo-utils-cpp.pc.in index 6e38633..54638e9 100644 --- a/cmake/geo-utils-cpp.pc.in +++ b/cmake/geo-utils-cpp.pc.in @@ -1,6 +1,6 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix} -includedir=${prefix}/@CMAKE_INSTALL_FULL_INCLUDEDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ Name: geo-utils-cpp Description: Header-only C++ geographic utilities diff --git a/docs/getting-started.md b/docs/getting-started.md index 73ea710..3e435b3 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -27,7 +27,7 @@ target_link_libraries(your_target PRIVATE geo::utils) Install the library first, then: ```cmake -find_package(GeoUtilsCpp 1.0 REQUIRED) +find_package(GeoUtilsCpp 1.0.1 REQUIRED) target_link_libraries(your_target PRIVATE geo::utils) ``` diff --git a/tests/consumer/CMakeLists.txt b/tests/consumer/CMakeLists.txt index a366f08..c5a7312 100644 --- a/tests/consumer/CMakeLists.txt +++ b/tests/consumer/CMakeLists.txt @@ -5,7 +5,7 @@ project(geo_utils_cpp_consumer LANGUAGES CXX) # link against geo::utils, and run a minimal program. Intended to be configured # against an install prefix from the install workflow. -find_package(GeoUtilsCpp 1.0 REQUIRED) +find_package(GeoUtilsCpp 1.0.1 REQUIRED) add_executable(app main.cpp) target_link_libraries(app PRIVATE geo::utils) From c530ce42b7a8f23a1751c02561cc3210424b00d7 Mon Sep 17 00:00:00 2001 From: Aleksandr Kovalko Date: Thu, 7 May 2026 20:34:44 +0200 Subject: [PATCH 3/5] Invalidate FetchContent cache on repo rename --- .github/workflows/ci.yml | 5 ++++- .github/workflows/coverage.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b91f71..4f11f72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,10 @@ jobs: uses: actions/cache@v4 with: path: build/_deps - key: ${{ runner.os }}-${{ matrix.name }}-googletest-1.14.0 + # Include repo name in the key so a repo rename (which changes the + # absolute work-dir path baked into FetchContent's subbuild cache) + # invalidates stale caches automatically. + key: ${{ runner.os }}-${{ matrix.name }}-${{ github.event.repository.name }}-googletest-1.14.0 - name: Configure run: cmake -S . -B build -DGEO_UTILS_CPP_BUILD_TESTS=ON -DGEO_UTILS_CPP_BUILD_EXAMPLES=ON diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index c09b210..7c91fff 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -36,7 +36,10 @@ jobs: uses: actions/cache@v4 with: path: build/_deps - key: ${{ runner.os }}-coverage-googletest-1.14.0 + # Include repo name in the key so a repo rename (which changes the + # absolute work-dir path baked into FetchContent's subbuild cache) + # invalidates stale caches automatically. + key: ${{ runner.os }}-coverage-${{ github.event.repository.name }}-googletest-1.14.0 - name: Install gcovr run: pip install gcovr From ec35b3465bccc16479a6843e182a6760f255e4b4 Mon Sep 17 00:00:00 2001 From: Aleksandr Kovalko Date: Thu, 7 May 2026 20:54:35 +0200 Subject: [PATCH 4/5] Make pkg-config file relocatable across install prefixes --- .github/workflows/install.yml | 19 ++++++++++++++----- cmake/geo-utils-cpp.pc.in | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 35c6ea6..f143f3d 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -2,7 +2,7 @@ # # Installs the library to a temporary prefix, then configures and builds a # minimal consumer project (tests/consumer/) against that prefix using -# `find_package(GeoUtilsCpp 1.0 REQUIRED)` and `target_link_libraries(... geo::utils)`. +# `find_package(GeoUtilsCpp 1.0.1 REQUIRED)` and `target_link_libraries(... geo::utils)`. # Runs the consumer to verify end-to-end integration. # # Catches regressions in install paths, exported target names, and @@ -50,8 +50,10 @@ jobs: - name: Install library run: cmake --install build --config Release --prefix ${{ runner.temp }}/prefix - # pkg-config sanity: catches regressions in the .pc template (e.g. a - # malformed includedir that would expand into a doubled absolute path). + # pkg-config sanity: catches regressions in the .pc template, including + # malformed includedirs (doubled prefix → //) and non-relocatable templates + # (the resolved includedir must actually contain our headers, not point at + # a configure-time prefix that no longer matches the install location). # Skipped on Windows — pkg-config isn't part of the default toolchain. - name: Verify pkg-config metadata if: runner.os != 'Windows' @@ -60,12 +62,19 @@ jobs: run: | version=$(pkg-config --modversion geo-utils-cpp) cflags=$(pkg-config --cflags geo-utils-cpp) - echo "version: $version" - echo "cflags: $cflags" + include_dir=$(pkg-config --variable=includedir geo-utils-cpp) + echo "version: $version" + echo "cflags: $cflags" + echo "includedir: $include_dir" test "$version" = "1.0.1" case "$cflags" in *//*) echo "ERROR: doubled-slash in include path: $cflags" >&2; exit 1 ;; esac + test -f "$include_dir/geo/geo.hpp" || { + echo "ERROR: header missing at $include_dir/geo/geo.hpp" >&2 + echo " (the .pc file points outside the install prefix — likely a relocation bug)" >&2 + exit 1 + } - name: Configure consumer run: cmake -S tests/consumer -B build-consumer -DCMAKE_PREFIX_PATH=${{ runner.temp }}/prefix diff --git a/cmake/geo-utils-cpp.pc.in b/cmake/geo-utils-cpp.pc.in index 54638e9..fa691f3 100644 --- a/cmake/geo-utils-cpp.pc.in +++ b/cmake/geo-utils-cpp.pc.in @@ -1,6 +1,6 @@ -prefix=@CMAKE_INSTALL_PREFIX@ +prefix=${pcfiledir}/../.. exec_prefix=${prefix} -includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ Name: geo-utils-cpp Description: Header-only C++ geographic utilities From 35d98b655f33e9eb38c585db3985c49337964791 Mon Sep 17 00:00:00 2001 From: Aleksandr Kovalko Date: Thu, 7 May 2026 21:35:06 +0200 Subject: [PATCH 5/5] Make .pc file generation match install location --- .github/workflows/install.yml | 7 +++++-- cmake/geo-utils-cpp.pc.in | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index f143f3d..7805a98 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -41,14 +41,17 @@ jobs: steps: - uses: actions/checkout@v4 + # CMAKE_INSTALL_PREFIX is set at configure time so it's baked into the + # generated .pc file; the install step must not pass --prefix or the + # .pc would point at the configure-time prefix while files land elsewhere. - name: Configure library - run: cmake -S . -B build + run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/prefix - name: Build library run: cmake --build build --config Release - name: Install library - run: cmake --install build --config Release --prefix ${{ runner.temp }}/prefix + run: cmake --install build --config Release # pkg-config sanity: catches regressions in the .pc template, including # malformed includedirs (doubled prefix → //) and non-relocatable templates diff --git a/cmake/geo-utils-cpp.pc.in b/cmake/geo-utils-cpp.pc.in index fa691f3..a64f96d 100644 --- a/cmake/geo-utils-cpp.pc.in +++ b/cmake/geo-utils-cpp.pc.in @@ -1,5 +1,4 @@ -prefix=${pcfiledir}/../.. -exec_prefix=${prefix} +prefix=@CMAKE_INSTALL_PREFIX@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ Name: geo-utils-cpp