Skip to content

Move package-discovery from configure-time to CTest to avoid partial install prefix failures#522

Merged
EnekoGonzalez3 merged 3 commits intodevelopfrom
520-fix-package-discovery-cmake-using-incomplete-install-prefix
Feb 12, 2026
Merged

Move package-discovery from configure-time to CTest to avoid partial install prefix failures#522
EnekoGonzalez3 merged 3 commits intodevelopfrom
520-fix-package-discovery-cmake-using-incomplete-install-prefix

Conversation

@EnekoGonzalez3
Copy link
Contributor

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.

…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>
@EnekoGonzalez3 EnekoGonzalez3 marked this pull request as ready for review February 11, 2026 00:23
EnekoGonzalez3 and others added 2 commits February 12, 2026 09:59
…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.
@EnekoGonzalez3 EnekoGonzalez3 merged commit d6ea16b into develop Feb 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants