Skip to content

COMP: Guard the CMP0169 policy setting so older CMake still configures - #87

Merged
hjmjohnson merged 2 commits into
ci/test-output-on-failurefrom
ci/guard-cmp0169
Oct 6, 2026
Merged

hjmjohnson merged 2 commits into
ci/test-output-on-failurefrom
ci/guard-cmp0169

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Re-submission of #30, reverted from master on 2026-09-24 so it can be
reviewed before merging. Content is unchanged from the original.

Stack position 3 of 10. Base: ci/test-output-on-failure (#28), not master.
Merge the PRs above it in this stack first, or the diff shown here will
include their commits too.

Ordering for this stack

# PR branch base
1 #29 ci/install-linking-srcdir master
2 #28 ci/test-output-on-failure ci/install-linking-srcdir
3 #30 <- this PR ci/guard-cmp0169 ci/test-output-on-failure
4 #75 ci/build-all-codepaths ci/guard-cmp0169
5 #77 ci/widen-coverage ci/build-all-codepaths
6 #37 pr/fix-missing-prototypes ci/widen-coverage
7 #78 fix/buildyml-jobs pr/fix-missing-prototypes
8 #81 ci/missing-declarations fix/buildyml-jobs
9 #82 ci/windows ci/missing-declarations
10 #83 ci/workflow-trigger-lint ci/windows

The order is the order these changes sat on master before the revert, so
it is known to build and test at every step. Verified again after
rebuilding the stack: the tip configures, compiles with no errors, and
passes 344/344 tests.

Why this one is stacked rather than independent

Each PR in this chain edits the same few files as its predecessors, chiefly
.github/workflows/cmake-multi-platform.yml, cmake/exported_symbols_linux.txt
and cifti/afni_xml.h. Cherry-picked onto master alone, the later ones
conflict. Two members also carry a build-order dependency rather than a
textual one: without #30 the project does not configure at all on CMake
versions that do not know policy CMP0169, and #29 is needed for
install_linking to find its source directory.

Commits
  • COMP: Guard the CMP0169 policy setting so older CMake still configures

See #84 for the ordering of all 49 re-submitted pull requests.

CMakeLists.txt sets policy CMP0169 unconditionally, to keep using the
deprecated FetchContent_Populate.  CMP0169 was introduced in CMake 3.30,
and cmake_policy(SET) on an unknown policy is a hard error, so any CMake
older than that fails to configure at all:

    CMake Error at CMakeLists.txt:175 (cmake_policy):
      Policy "CMP0169" is not known to this version of CMake.

That includes the CMake 3.28 shipped by Ubuntu 24.04, which is what the
CI runners and the project's own Dockerfile use, and it sits well above
the cmake_minimum_required(VERSION 3.10.2) the project advertises.

Wrapping it in if(POLICY CMP0169) is the standard idiom.  Verified
configuring with both CMake 3.28.3 and 4.4.2.

(cherry picked from commit 3aefe1b)
@hjmjohnson
hjmjohnson marked this pull request as ready for review September 24, 2026 12:03
The build never set a C standard, so it used the compiler default.  Set
CMAKE_C_STANDARD 11 with C_EXTENSIONS OFF.

Two POSIX dependencies were being satisfied silently by the gnu default
and now have to be requested:

  cifti/afni_xml.c     strdup(), 3 uses.  Without a declaration this was
                       an implicit function declaration returning int
                       assigned to char * -- an error in C99 onward.
  nifti1_io.c,         popen()/pclose() in the optional PIGZ write path,
  nifti2_io.c          only compiled with -DFSLSTYLE_PIGZ_SUPPORT=ON.

Each file defines _POSIX_C_SOURCE 200809L ahead of its includes, so the
dependency is visible where it is taken.

(cherry picked from commit 49b48b4)
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