[CRITICAL BUGFIX] Fix a significant oversight in **GrackleConfig.cmake** #330
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.
This PR fixes a significant bug in GrackleConfig.cmake that causes applications with CMake-build systems that expect to link against free-standing installations of Grackle (i.e. Grackle is pre-built) to break when using the newest versions of CMake (version 4.0 or newer).
Background
As part of the installation-process, the CMake build-system installs a file called GrackleConfig.cmake alongside the Grackle headers and libraries. This is a special kind CMake script that a build-system searches for and reads when you want to building a downstream application that links against a free-standing Grackle installation. Basically, the script contains queryable metadata about how Grackle was configured and the necessary linker/compilation flags.
While we require version 3.16 of CMake or newer to actually build/install the core Grackle library, I followed standard convention and tried to make it possible for the GrackleConfig.cmake file to be used by CMake 3.3 (basically as early a version of CMake as possible).
The Problem
I mistakenly used the
cmake_minimum_versioncommand within GrackleConfig.cmake to ensure that the file wasn't read by a version of CMake older than 3.3.Everything seemed to work fine at first. I only realized this was an issue today. It turns out that with the release of CMake 4.0 (released at the end of March), that calling
cmake_minimum_versionto try enforce a minimum version before version 3.5 now causes CMake to abort with an error.Consequently, people can use CMake 4.0 (or newer) to perform a full standalone installation of Grackle. However, if they then turn around and try to link against that version of Grackle (with that same CMake version), CMake will abort with an error. It's worth noting that doing an embedded install of Grackle (e.g. compiling Grackle as part of the downstream application) using CMake won't cause any problems, but the scenario I highlighted is an extremely plausible way of using CMake.
The Solution
Fixing this is easy. We simply delete the call to
cmake_minimum_versionin the GrackleConfig.cmake file. For whatever reason I had previously written a separate redundant check enforcing the minimum CMake version that we can leave in place.Ramifications
I really think we should consider making a 3.4.1 release of grackle with this bugfix. This is only going to be a bigger problem as time goes on (and people start using newer versions of CMake)