Move package-discovery from configure-time to CTest to avoid partial install prefix failures#522
Merged
EnekoGonzalez3 merged 3 commits intodevelopfrom Feb 12, 2026
Conversation
…configure - Refactor package-discovery so configure/build never depend on install prefix. Build-tree tests (PackageDiscovery_CMake, PackageDiscovery_pkgconfig) always link against chronolog_client; no find_package(Chronolog) at configure time. - Add CTest scripts RunPackageDiscoveryCMake.cmake and RunPackageDiscoveryPkgConfig.cmake that run at ctest time. They treat prefix as 'installed' only when config + lib + headers all exist; otherwise skip with clear message. Validates find_package and pkg-config against the actual install without blocking cmake/make. - Pass EXTRA_CMAKE_PREFIX_PATH and spdlog_DIR into installed discovery tests so the discovery subproject can find spdlog (and other deps) the same way as the main build. - ChronologConfig.cmake.in: include(CMakeFindDependencyMacro) so find_dependency is available in the installed config. Fixes the case where stale ChronologConfig.cmake/chronolog.pc in the install prefix (with missing lib/headers) caused configure to fail and block make install. Co-authored-by: Cursor <cursoragent@cursor.com>
ibrodkin
approved these changes
Feb 11, 2026
fkengun
reviewed
Feb 11, 2026
…omplete-install-prefix
…ion behavior. Mark tests as not installed, indicating they run from the build tree only, and that installed-prefix tests utilize their own mini app. This change enhances clarity in the test configuration and ensures proper execution context for package discovery tests.
fkengun
approved these changes
Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Package-discovery no longer runs at configure time. It is implemented as CTest-based checks that only treat the install prefix as “installed” when all required artifacts exist, so a stale or partial install no longer blocks cmake or make install.
Problem
CMake package-discovery ran at configure time and could treat the install prefix as “installed” when only stale ChronologConfig.cmake / chronolog.pc were present and libchronolog_client.so (and/or headers) were missing (mixed/partial install). In that case, find_package(Chronolog) resolved to the install prefix and configure failed (e.g. missing lib/headers), blocking build and make install.
Solution
- Configure/build: Package-discovery no longer depends on the install prefix. The two discovery test executables are always built and linked against the build tree only (chronolog_client); no find_package(Chronolog) is run at configure time for the install prefix. So cmake .. and make (and make install) succeed even when the install prefix has stale config/.pc but missing lib/headers.
- Installed discovery: Validation of the installed prefix is done at CTest time via two scripts. They treat the prefix as “installed” only when all of config (and targets), .pc, libchronolog_client.*, and key headers exist. If any are missing, the tests skip (exit 0) with a clear message and do not run find_package(Chronolog) against that prefix, so there is no configure failure.