cmake v3.29.1 regression (up to cmake 3.29 is fine)

find_package() seems to be using or mangling the casing of paths when run, at least, from ExternalProject_Add.

Find attached a self-contained project that aborts with an error in find_package(). It builds OpenColorIO (a color management library after building its dependencies and then tries to find it with find_package()). Before v3.29.1 the build would work. With v3.29.1 it fails finding the libraries.

build_ocio.tar.gz (30 KB)

@craig.scott this bisects to CMake MR 9390.

In OpenColorIO this code is using a PACKAGE_PREFIX_DIR variable that CMakePackageConfigHelpers, in CMake 3.29.0 and below, generates as an implementation detail. 3.29.1 uses a different variable name.

It seems projects have been treating the undocumented PACKAGE_PREFIX_DIR implementation detail as if it were part of the public interface. See also CMake Issue 25873

As a user of OpenColorIO (not a developer for it), I reverted back to v3.29.0 for my CI builds.

However, moving forward, I would like to know what’s the suggested solution (revert v3.29.2 to 3.29.0 behavior --variable–, propose a real documented API variable, make all packages that depend on this old behavior change their code, or something else?).

Never mind. I just saw the “regression” commit by Brad King. Thanks for your hard-work!!!

CMake MR 9420 reverts the change. I’ve re-opened CMake Issue 25827 to discuss the problem that originally motivated the change.

For reference, we also were using PACKAGE_PREFIX_DIR as part of the public interface in matio-cpp (CI Failure April 2024 · Issue #78 · ami-iit/matio-cpp · GitHub), but we fixed that on our side in InstallBasicPackageFiles: Fix bug of OVERRIDE_MODULE_PATH that corrupt CMAKE_MODULE_PATH values set by blf transitive dependencies and fix OVERRIDE_MODULE_PATH with CMake 3.29.1 by traversaro · Pull Request #79 · ami-iit/matio-cpp · GitHub .

F3D is impacted as well.

We were using it because @PACKAGE_INIT@ expand to

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

And find it useful.

We just define it ourself now: Fix incorrect usage of internal variable PACKAGE_PREFIX_DIR by mwestphal · Pull Request #1377 · f3d-app/f3d · GitHub