COMP: Modernize CMake for add_subdirectory, googletest, and CMake 4.0 compatibility#130
Closed
hjmjohnson wants to merge 3 commits intoSCIInstitute:masterfrom
Closed
COMP: Modernize CMake for add_subdirectory, googletest, and CMake 4.0 compatibility#130hjmjohnson wants to merge 3 commits intoSCIInstitute:masterfrom
hjmjohnson wants to merge 3 commits intoSCIInstitute:masterfrom
Conversation
Author
|
@jcfr I'm trying to get all ITK remote modules to work. Cleaver is failing due to some upstream deprecated code and cmake requirements. |
c7c99b1 to
ecb553e
Compare
Replace CMAKE_BINARY_DIR, CMAKE_SOURCE_DIR, and CMAKE_CURRENT_SOURCE_DIR with CLEAVER2_BINARY_DIR and CLEAVER2_SOURCE_DIR throughout. This prevents variable collisions when Cleaver is consumed via add_subdirectory() from a parent project (e.g., ITKCleaver). Also unset EXECUTABLE_OUTPUT_PATH to stop propagating it to consuming projects. Co-Authored-By: stevencui2 <l5cui@uwaterloo.ca>
The old ExternalProject fetched an ancient fork (CIBC-Internal/googletest, branch "origin/cleaver") whose cmake_minimum_required predates 3.5, which CMake >= 4.0 rejects. Replace with FetchContent from google/googletest v1.15.2 and use the modern CMake targets (GTest::gtest_main, GTest::gmock). This eliminates 120 lines of manual library path handling, platform- specific linking workarounds, and the copy_deps ExternalProject step.
The vendored teem copy used cmake_minimum_required(VERSION 2.4), which CMake >= 4.0 rejects. Bump to 3.10.2 to match the rest of the project. Note: the upstream teem (github.com/mhalle/teem) now requires CMake 3.25; this is a conservative bump for the vendored copy.
ecb553e to
a65d048
Compare
hjmjohnson
added a commit
to hjmjohnson/ITKCleaver
that referenced
this pull request
Apr 15, 2026
The bundled googletest in SCIInstitute/Cleaver uses cmake_minimum_required < 3.5 which CMake >= 4.0 rejects. Disable BUILD_TESTING for the vendored lib unconditionally. Upstream fix tracked at SCIInstitute/Cleaver#130. The ITK module has its own CTest-based tests that are unaffected.
Author
|
Abandoning update to Cleaver. If this project becomes active again, revisit closed PRs. |
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.
Fix CMake >= 4.0 compatibility and improve add_subdirectory integration. Supersedes #129 (includes all its changes with cleaned-up commit history).
Motivated by SCIInstitute/ITKCleaver#77 — the ITK remote module CI currently works around these issues by forcing
BUILD_TESTING OFFfor the vendored Cleaver lib.Commits (3)