GENERATED prop: Check CMP0118 policy and warn in certain situations

* Adding tests for CMP0118 being unset (aka set to `WARN`).
* Adjusting the (unrelated) RunCMake.CMP0026 test to set CMP0118 to
  `NEW`,
* Adjusting the (unrelated) RunCMake.Ninja test to set CMP0118 to `OLD`.
* Adjusting the (unrelated) RunCMake.FileAPI test to set CMP0118 to
  `OLD`.

Note:
Setting CMP0118 to `NEW` and modifying the `GENERATED` property with
`set_property` or `set_source_files_properties` will currently NOT set
that property because the implementation is still to come.
This commit is contained in:
Deniz Bahadir
2020-09-30 21:11:14 +02:00
parent 0eb30f175e
commit ca4ce458a3
75 changed files with 1813 additions and 21 deletions
+8 -1
View File
@@ -7,6 +7,7 @@
#include <cm/string_view>
#include <cmext/algorithm>
#include <cmext/string_view>
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
@@ -167,7 +168,13 @@ static bool RunCommandForScope(
if (cmSourceFile* sf = mf->GetOrCreateSource(sfname)) {
// loop through the props and set them
for (auto k = propertyPairs.begin(); k != propertyPairs.end(); k += 2) {
sf->SetProperty(*k, (k + 1)->c_str());
// Special handling for GENERATED property?
if (*k == "GENERATED"_s) {
SetPropertyCommand::HandleAndValidateSourceFilePropertyGENERATED(
sf, *(k + 1));
} else {
sf->SetProperty(*k, (k + 1)->c_str());
}
}
}
}