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 994061436a..9a4f7c0ba9 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -108,7 +108,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 1142b0ed9f..752be99be7 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