summaryrefslogtreecommitdiffstats
path: root/Source/cmSetPropertyCommand.cxx
diff options
context:
space:
mode:
authorDeniz Bahadir <deniz@code.bahadir.email>2024-03-28 13:16:10 (GMT)
committerBrad King <brad.king@kitware.com>2024-03-29 12:54:11 (GMT)
commit071f0d6f983546cf7ec5ab8a376c4d547293304a (patch)
treeb73f4340bbca884dd3f22593e0f6d8ef6e368e60 /Source/cmSetPropertyCommand.cxx
parent00c6573d86ad7d008c250bb89de7548c3bfa6f41 (diff)
downloadCMake-071f0d6f983546cf7ec5ab8a376c4d547293304a.zip
CMake-071f0d6f983546cf7ec5ab8a376c4d547293304a.tar.gz
CMake-071f0d6f983546cf7ec5ab8a376c4d547293304a.tar.bz2
CMP0163: Make GENERATED source file property globally visible
This was originally attempted by policy CMP0118, but its implementation did not cover all intended use cases. We fixed its documentation in commit 1dabbbb5e0 (CMP0118: Revise documentation to describe actual behavior, 2024-03-20). Add new policy CMP0163 to cover the remaining use cases. In particular, make the `GENERATED` property visible to `get_property` calls in other directories. In order to capture the original intention of CMP0118, define CMP0163's NEW behavior to also imply CMP0118's NEW behavior. Fixes: #25437 Fixes: #25058
Diffstat (limited to 'Source/cmSetPropertyCommand.cxx')
-rw-r--r--Source/cmSetPropertyCommand.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 5dfb68d..a229ea2 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -284,7 +284,8 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
{
const auto& mf = *sf->GetLocation().GetMakefile();
- auto isProblematic = [&mf, &propertyValue, op](cm::string_view policy) {
+ auto isProblematic = [&mf, &propertyValue,
+ op](cm::string_view policy) -> bool {
if (!cmIsOn(propertyValue) && !cmIsOff(propertyValue)) {
mf.IssueMessage(
MessageType::AUTHOR_ERROR,
@@ -313,6 +314,16 @@ bool HandleAndValidateSourceFilePropertyGENERATED(
return false;
};
+ const auto cmp0163PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0163);
+ const bool cmp0163PolicyNEW = cmp0163PolicyStatus != cmPolicies::OLD &&
+ cmp0163PolicyStatus != cmPolicies::WARN;
+ if (cmp0163PolicyNEW) {
+ if (!isProblematic("CMP0163")) {
+ sf->MarkAsGenerated();
+ }
+ return true;
+ }
+
const auto cmp0118PolicyStatus = mf.GetPolicyStatus(cmPolicies::CMP0118);
const bool cmp0118PolicyWARN = cmp0118PolicyStatus == cmPolicies::WARN;
const bool cmp0118PolicyNEW =