From 228795753f5736a50710d8e5ab0840d3b0187af5 Mon Sep 17 00:00:00 2001 From: Matthew Woehlke Date: Thu, 28 May 2026 16:53:01 -0400 Subject: [PATCH] FILE_SET: Fix CMP0211-related documentation Commit 4f120beea9 (FILE_SET: relax file uniqueness for HEADERS type, 2026-05-10) relaxed the restriction on file uniqueness in file sets, but did not correctly update all instances of the documentation. Change the wording to be a bit clearer and update all instances. --- Help/command/target_sources.rst | 4 ++-- Help/manual/cmake-policies.7.rst | 2 +- Help/policy/CMP0211.rst | 4 ++-- Source/cmPolicies.h | 5 +++-- .../target_sources/CMP0211-WARN-stderr.txt | 14 ++++++++------ 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Help/command/target_sources.rst b/Help/command/target_sources.rst index 374d828a52..b3c55390dd 100644 --- a/Help/command/target_sources.rst +++ b/Help/command/target_sources.rst @@ -80,8 +80,8 @@ have zero or more named file sets. Each file set has a name, a type, a scope of files within those directories. .. versionchanged:: 4.4 - A file may only belong to at most one file set in a target. See policy - :policy:`CMP0211`. + A file may belong to at most one non-``HEADERS`` file set in a target. + See policy :policy:`CMP0211`. The acceptable types include: diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 6728fee232..30723290c4 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -107,7 +107,7 @@ Policies Introduced by CMake 4.4 CMP0214: Honor CMAKE_EXE_LINKER_FLAGS for Swift executable targets. CMP0213: file(ARCHIVE_{CREATE,EXTRACT}) encode archive paths as UTF-8 by default. CMP0212: add_custom_command DEPENDS does not strip .exe suffixes. - CMP0211: A file may belong to at most one file set in a target. + CMP0211: A file may belong to at most one non-HEADERS file set in a target. Policies Introduced by CMake 4.3 -------------------------------- diff --git a/Help/policy/CMP0211.rst b/Help/policy/CMP0211.rst index 376ae1e956..54ddf709e2 100644 --- a/Help/policy/CMP0211.rst +++ b/Help/policy/CMP0211.rst @@ -3,8 +3,8 @@ CMP0211 .. versionadded:: 4.4 -A file may belong to at most one :ref:`file set ` in a target except -for the ``HEADERS`` file set type. +A file may belong to at most one non-``HEADERS`` :ref:`file set ` +in a target. In CMake 4.3 and below, it was possible to specify the same file in multiple file sets in a target. In CMake 4.4 and above, a file diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a7aab42e29..fa19ab413b 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -631,8 +631,9 @@ class cmMakefile; "CMAKE__LINK_FLAGS adds link flags to all target types.", 4, \ 3, 0, WARN) \ SELECT(POLICY, CMP0211, \ - "A file may belong to at most one file set in a target.", 4, 4, 0, \ - WARN) \ + "A file may belong to at most one non-HEADERS file set in a " \ + "target.", \ + 4, 4, 0, WARN) \ SELECT(POLICY, CMP0212, \ "add_custom_command DEPENDS does not strip .exe suffixes.", 4, 4, 0, \ WARN) \ diff --git a/Tests/RunCMake/target_sources/CMP0211-WARN-stderr.txt b/Tests/RunCMake/target_sources/CMP0211-WARN-stderr.txt index 17e62769e3..c886339289 100644 --- a/Tests/RunCMake/target_sources/CMP0211-WARN-stderr.txt +++ b/Tests/RunCMake/target_sources/CMP0211-WARN-stderr.txt @@ -1,7 +1,8 @@ CMake Warning \(policy\) in CMakeLists\.txt: - Policy CMP0211 is not set: A file may belong to at most one file set in a - target\. Run "cmake --help-policy CMP0211" for policy details\. Use the - cmake_policy command to set the policy and suppress this warning\. + Policy CMP0211 is not set: A file may belong to at most one non-HEADERS + file set in a target\. Run "cmake --help-policy CMP0211" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. In target "foo1" the file @@ -12,9 +13,10 @@ This warning is for project developers\. Use -Wno-author or -Wno-policy to suppress it\. CMake Warning \(policy\) in CMakeLists\.txt: - Policy CMP0211 is not set: A file may belong to at most one file set in a - target\. Run "cmake --help-policy CMP0211" for policy details\. Use the - cmake_policy command to set the policy and suppress this warning\. + Policy CMP0211 is not set: A file may belong to at most one non-HEADERS + file set in a target\. Run "cmake --help-policy CMP0211" for policy + details\. Use the cmake_policy command to set the policy and suppress this + warning\. In target "foo2" the file