cmTarget: Don't allow setting read-only properties
Ensure that all documented read-only target properties now produce errors when trying to set.
This commit is contained in:
parent
eee631bb8a
commit
0cfd8fe8ad
@ -57,6 +57,7 @@ Policies Introduced by CMake 3.29
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
|
|
||||||
|
CMP0160: More read-only target properties now error when trying to set them. </policy/CMP0160>
|
||||||
CMP0159: file(STRINGS) with REGEX updates CMAKE_MATCH_<n>. </policy/CMP0159>
|
CMP0159: file(STRINGS) with REGEX updates CMAKE_MATCH_<n>. </policy/CMP0159>
|
||||||
CMP0158: add_test() honors CMAKE_CROSSCOMPILING_EMULATOR only when cross-compiling. </policy/CMP0158>
|
CMP0158: add_test() honors CMAKE_CROSSCOMPILING_EMULATOR only when cross-compiling. </policy/CMP0158>
|
||||||
CMP0157: Swift compilation mode is selected by an abstraction. </policy/CMP0157>
|
CMP0157: Swift compilation mode is selected by an abstraction. </policy/CMP0157>
|
||||||
|
39
Help/policy/CMP0160.rst
Normal file
39
Help/policy/CMP0160.rst
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
CMP0160
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. versionadded:: 3.29
|
||||||
|
|
||||||
|
More read-only target properties now error when trying to set them.
|
||||||
|
|
||||||
|
The :command:`set_target_properties` and :command:`set_property` commands
|
||||||
|
are intended to error out on all read-only properties. However, CMake 3.28 and
|
||||||
|
below only did this for the following properties:
|
||||||
|
|
||||||
|
* :prop_tgt:`HEADER_SETS`
|
||||||
|
* :prop_tgt:`INTERFACE_HEADER_SETS`
|
||||||
|
* :prop_tgt:`IMPORTED_GLOBAL`
|
||||||
|
* :prop_tgt:`MANUALLY_ADDED_DEPENDENCIES`
|
||||||
|
* :prop_tgt:`NAME`
|
||||||
|
* :prop_tgt:`TYPE`
|
||||||
|
|
||||||
|
This policy enforces the read-only nature of the following target properties:
|
||||||
|
|
||||||
|
* :prop_tgt:`ALIAS_GLOBAL`
|
||||||
|
* :prop_tgt:`BINARY_DIR`
|
||||||
|
* :prop_tgt:`CXX_MODULE_SETS`
|
||||||
|
* :prop_tgt:`IMPORTED`
|
||||||
|
* :prop_tgt:`INTERFACE_CXX_MODULE_SETS`
|
||||||
|
* :prop_tgt:`LOCATION`
|
||||||
|
* :prop_tgt:`LOCATION_<CONFIG>`
|
||||||
|
* :prop_tgt:`SOURCE_DIR`
|
||||||
|
|
||||||
|
The ``OLD`` behavior for this policy is to only error out for the properties
|
||||||
|
:prop_tgt:`MANUALLY_ADDED_DEPENDENCIES`, :prop_tgt:`NAME`, and :prop_tgt:`TYPE`.
|
||||||
|
The ``NEW`` behavior for this policy is to error out on all target properties
|
||||||
|
that are documented as read-only.
|
||||||
|
|
||||||
|
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.29
|
||||||
|
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
|
||||||
|
.. include:: STANDARD_ADVICE.txt
|
||||||
|
|
||||||
|
.. include:: DEPRECATED.txt
|
@ -487,7 +487,11 @@ class cmMakefile;
|
|||||||
3, 29, 0, cmPolicies::WARN) \
|
3, 29, 0, cmPolicies::WARN) \
|
||||||
SELECT(POLICY, CMP0159, \
|
SELECT(POLICY, CMP0159, \
|
||||||
"file(STRINGS) with REGEX updates CMAKE_MATCH_<n>.", 3, 29, 0, \
|
"file(STRINGS) with REGEX updates CMAKE_MATCH_<n>.", 3, 29, 0, \
|
||||||
cmPolicies::WARN)
|
cmPolicies::WARN) \
|
||||||
|
SELECT( \
|
||||||
|
POLICY, CMP0160, \
|
||||||
|
"More read-only target properties now error when trying to set them.", 3, \
|
||||||
|
29, 0, cmPolicies::WARN)
|
||||||
|
|
||||||
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
|
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
|
||||||
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
#define CM_FOR_EACH_POLICY_ID(POLICY) \
|
||||||
@ -529,7 +533,8 @@ class cmMakefile;
|
|||||||
F(CMP0154) \
|
F(CMP0154) \
|
||||||
F(CMP0155) \
|
F(CMP0155) \
|
||||||
F(CMP0156) \
|
F(CMP0156) \
|
||||||
F(CMP0157)
|
F(CMP0157) \
|
||||||
|
F(CMP0160)
|
||||||
|
|
||||||
#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
|
#define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \
|
||||||
F(CMP0116) \
|
F(CMP0116) \
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
#include <cm/memory>
|
#include <cm/memory>
|
||||||
@ -801,18 +802,6 @@ bool FileSetType::WriteProperties(cmTarget* tgt, cmTargetInternals* impl,
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (prop == this->SelfEntries.PropertyName) {
|
|
||||||
impl->Makefile->IssueMessage(
|
|
||||||
MessageType::FATAL_ERROR,
|
|
||||||
cmStrCat(this->SelfEntries.PropertyName, " property is read-only\n"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (prop == this->InterfaceEntries.PropertyName) {
|
|
||||||
impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
|
|
||||||
cmStrCat(this->InterfaceEntries.PropertyName,
|
|
||||||
" property is read-only\n"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1980,7 +1969,6 @@ MAKE_PROP(CUDA_CUBIN_COMPILATION);
|
|||||||
MAKE_PROP(CUDA_FATBIN_COMPILATION);
|
MAKE_PROP(CUDA_FATBIN_COMPILATION);
|
||||||
MAKE_PROP(CUDA_OPTIX_COMPILATION);
|
MAKE_PROP(CUDA_OPTIX_COMPILATION);
|
||||||
MAKE_PROP(CUDA_PTX_COMPILATION);
|
MAKE_PROP(CUDA_PTX_COMPILATION);
|
||||||
MAKE_PROP(EXPORT_NAME);
|
|
||||||
MAKE_PROP(IMPORTED);
|
MAKE_PROP(IMPORTED);
|
||||||
MAKE_PROP(IMPORTED_GLOBAL);
|
MAKE_PROP(IMPORTED_GLOBAL);
|
||||||
MAKE_PROP(INCLUDE_DIRECTORIES);
|
MAKE_PROP(INCLUDE_DIRECTORIES);
|
||||||
@ -2006,43 +1994,118 @@ MAKE_PROP(INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE);
|
|||||||
#undef MAKE_PROP
|
#undef MAKE_PROP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
enum class ReadOnlyCondition
|
||||||
|
{
|
||||||
|
All,
|
||||||
|
Imported,
|
||||||
|
NonImported,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ReadOnlyProperty
|
||||||
|
{
|
||||||
|
ReadOnlyProperty(ReadOnlyCondition cond)
|
||||||
|
: Condition{ cond }
|
||||||
|
, Policy{} {};
|
||||||
|
ReadOnlyProperty(ReadOnlyCondition cond, cmPolicies::PolicyID id)
|
||||||
|
: Condition{ cond }
|
||||||
|
, Policy{ id } {};
|
||||||
|
|
||||||
|
ReadOnlyCondition Condition;
|
||||||
|
cm::optional<cmPolicies::PolicyID> Policy;
|
||||||
|
|
||||||
|
std::string message(const std::string& prop, cmTarget* target) const
|
||||||
|
{
|
||||||
|
std::string msg;
|
||||||
|
if (this->Condition == ReadOnlyCondition::All) {
|
||||||
|
msg = " property is read-only for target(\"";
|
||||||
|
} else if (this->Condition == ReadOnlyCondition::Imported) {
|
||||||
|
msg = " property can't be set on imported targets(\"";
|
||||||
|
} else if (this->Condition == ReadOnlyCondition::NonImported) {
|
||||||
|
msg = " property can't be set on non-imported targets(\"";
|
||||||
|
}
|
||||||
|
return cmStrCat(prop, msg, target->GetName(), "\")\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isReadOnly(const std::string& prop, cmMakefile* context,
|
||||||
|
cmTarget* target) const
|
||||||
|
{
|
||||||
|
auto importedTarget = target->IsImported();
|
||||||
|
bool matchingCondition = true;
|
||||||
|
if ((!importedTarget && this->Condition == ReadOnlyCondition::Imported) ||
|
||||||
|
(importedTarget &&
|
||||||
|
this->Condition == ReadOnlyCondition::NonImported)) {
|
||||||
|
matchingCondition = false;
|
||||||
|
}
|
||||||
|
if (!matchingCondition) {
|
||||||
|
// Not read-only in this scenario
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool readOnly = true;
|
||||||
|
if (!this->Policy) {
|
||||||
|
// No policy associated, so is always read-only
|
||||||
|
context->IssueMessage(MessageType::FATAL_ERROR,
|
||||||
|
this->message(prop, target));
|
||||||
|
} else {
|
||||||
|
switch (target->GetPolicyStatus(*this->Policy)) {
|
||||||
|
case cmPolicies::WARN:
|
||||||
|
context->IssueMessage(
|
||||||
|
MessageType::AUTHOR_WARNING,
|
||||||
|
cmPolicies::GetPolicyWarning(cmPolicies::CMP0160) + "\n" +
|
||||||
|
this->message(prop, target));
|
||||||
|
CM_FALLTHROUGH;
|
||||||
|
case cmPolicies::OLD:
|
||||||
|
readOnly = false;
|
||||||
|
break;
|
||||||
|
case cmPolicies::REQUIRED_ALWAYS:
|
||||||
|
case cmPolicies::REQUIRED_IF_USED:
|
||||||
|
case cmPolicies::NEW:
|
||||||
|
context->IssueMessage(MessageType::FATAL_ERROR,
|
||||||
|
this->message(prop, target));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return readOnly;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
bool IsSetableProperty(cmMakefile* context, cmTarget* target,
|
||||||
|
const std::string& prop)
|
||||||
|
{
|
||||||
|
using ROC = ReadOnlyCondition;
|
||||||
|
static std::unordered_map<std::string, ReadOnlyProperty> const readOnlyProps{
|
||||||
|
{ "EXPORT_NAME", { ROC::Imported } },
|
||||||
|
{ "HEADER_SETS", { ROC::All } },
|
||||||
|
{ "IMPORTED_GLOBAL", { ROC::NonImported } },
|
||||||
|
{ "INTERFACE_HEADER_SETS", { ROC::All } },
|
||||||
|
{ "MANUALLY_ADDED_DEPENDENCIES", { ROC::All } },
|
||||||
|
{ "NAME", { ROC::All } },
|
||||||
|
{ "SOURCES", { ROC::Imported } },
|
||||||
|
{ "TYPE", { ROC::All } },
|
||||||
|
{ "ALIAS_GLOBAL", { ROC::All, cmPolicies::CMP0160 } },
|
||||||
|
{ "BINARY_DIR", { ROC::All, cmPolicies::CMP0160 } },
|
||||||
|
{ "CXX_MODULE_SETS", { ROC::All, cmPolicies::CMP0160 } },
|
||||||
|
{ "IMPORTED", { ROC::All, cmPolicies::CMP0160 } },
|
||||||
|
{ "INTERFACE_CXX_MODULE_SETS", { ROC::All, cmPolicies::CMP0160 } },
|
||||||
|
{ "LOCATION", { ROC::All, cmPolicies::CMP0160 } },
|
||||||
|
{ "LOCATION_CONFIG", { ROC::All, cmPolicies::CMP0160 } },
|
||||||
|
{ "SOURCE_DIR", { ROC::All, cmPolicies::CMP0160 } }
|
||||||
|
};
|
||||||
|
|
||||||
|
auto it = readOnlyProps.find(prop);
|
||||||
|
|
||||||
|
if (it != readOnlyProps.end()) {
|
||||||
|
return !(it->second.isReadOnly(prop, context, target));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cmTarget::SetProperty(const std::string& prop, cmValue value)
|
void cmTarget::SetProperty(const std::string& prop, cmValue value)
|
||||||
{
|
{
|
||||||
if (prop == propMANUALLY_ADDED_DEPENDENCIES) {
|
if (!IsSetableProperty(this->impl->Makefile, this, prop)) {
|
||||||
this->impl->Makefile->IssueMessage(
|
|
||||||
MessageType::FATAL_ERROR,
|
|
||||||
"MANUALLY_ADDED_DEPENDENCIES property is read-only\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop == propNAME) {
|
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
|
|
||||||
"NAME property is read-only\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop == propTYPE) {
|
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
|
|
||||||
"TYPE property is read-only\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop == propEXPORT_NAME && this->IsImported()) {
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "EXPORT_NAME property can't be set on imported targets (\""
|
|
||||||
<< this->impl->Name << "\")\n";
|
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop == propSOURCES && this->IsImported()) {
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "SOURCES property can't be set on imported targets (\""
|
|
||||||
<< this->impl->Name << "\")\n";
|
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop == propIMPORTED_GLOBAL && !this->IsImported()) {
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "IMPORTED_GLOBAL property can't be set on non-imported targets (\""
|
|
||||||
<< this->impl->Name << "\")\n";
|
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2187,40 +2250,23 @@ void cmTarget::AppendProperty(const std::string& prop,
|
|||||||
cm::optional<cmListFileBacktrace> const& bt,
|
cm::optional<cmListFileBacktrace> const& bt,
|
||||||
bool asString)
|
bool asString)
|
||||||
{
|
{
|
||||||
if (prop == "NAME") {
|
if (!IsSetableProperty(this->impl->Makefile, this, prop)) {
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR,
|
|
||||||
"NAME property is read-only\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop == "EXPORT_NAME" && this->IsImported()) {
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "EXPORT_NAME property can't be set on imported targets (\""
|
|
||||||
<< this->impl->Name << "\")\n";
|
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop == "SOURCES" && this->IsImported()) {
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "SOURCES property can't be set on imported targets (\""
|
|
||||||
<< this->impl->Name << "\")\n";
|
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prop == "IMPORTED_GLOBAL") {
|
if (prop == "IMPORTED_GLOBAL") {
|
||||||
std::ostringstream e;
|
this->impl->Makefile->IssueMessage(
|
||||||
e << "IMPORTED_GLOBAL property can't be appended, only set on imported "
|
MessageType::FATAL_ERROR,
|
||||||
"targets (\""
|
cmStrCat("IMPORTED_GLOBAL property can't be appended, only set on "
|
||||||
<< this->impl->Name << "\")\n";
|
"imported targets (\"",
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
this->impl->Name, "\")\n"));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (prop == propPRECOMPILE_HEADERS &&
|
if (prop == propPRECOMPILE_HEADERS &&
|
||||||
this->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
|
this->GetProperty("PRECOMPILE_HEADERS_REUSE_FROM")) {
|
||||||
std::ostringstream e;
|
this->impl->Makefile->IssueMessage(
|
||||||
e << "PRECOMPILE_HEADERS_REUSE_FROM property is already set on target "
|
MessageType::FATAL_ERROR,
|
||||||
"(\""
|
cmStrCat(
|
||||||
<< this->impl->Name << "\")\n";
|
"PRECOMPILE_HEADERS_REUSE_FROM property is already set on target (\"",
|
||||||
this->impl->Makefile->IssueMessage(MessageType::FATAL_ERROR, e.str());
|
this->impl->Name, "\")\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
Tests/RunCMake/CMP0160/CMP0160-NEW-result.txt
Normal file
1
Tests/RunCMake/CMP0160/CMP0160-NEW-result.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
233
Tests/RunCMake/CMP0160/CMP0160-NEW-stderr.txt
Normal file
233
Tests/RunCMake/CMP0160/CMP0160-NEW-stderr.txt
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
HEADER_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_HEADER_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
MANUALLY_ADDED_DEPENDENCIES property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
NAME property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
TYPE property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
ALIAS_GLOBAL property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
BINARY_DIR property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
CXX_MODULE_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
IMPORTED property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_CXX_MODULE_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
LOCATION property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
LOCATION_CONFIG property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
SOURCE_DIR property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
IMPORTED_GLOBAL property can't be set on non-imported
|
||||||
|
targets\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
HEADER_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_HEADER_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
MANUALLY_ADDED_DEPENDENCIES property is read-only for
|
||||||
|
target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
NAME property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
TYPE property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
ALIAS_GLOBAL property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
BINARY_DIR property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
CXX_MODULE_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
IMPORTED property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_CXX_MODULE_SETS property is read-only for
|
||||||
|
target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
LOCATION property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
LOCATION_CONFIG property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
SOURCE_DIR property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
EXPORT_NAME property can't be set on imported targets\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
SOURCES property can't be set on imported targets\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-NEW.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
4
Tests/RunCMake/CMP0160/CMP0160-NEW.cmake
Normal file
4
Tests/RunCMake/CMP0160/CMP0160-NEW.cmake
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
project(ReadOnly LANGUAGES NONE)
|
||||||
|
cmake_policy(SET CMP0160 NEW)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/READONLY_PROPERTIES.cmake)
|
1
Tests/RunCMake/CMP0160/CMP0160-OLD-result.txt
Normal file
1
Tests/RunCMake/CMP0160/CMP0160-OLD-result.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
104
Tests/RunCMake/CMP0160/CMP0160-OLD-stderr.txt
Normal file
104
Tests/RunCMake/CMP0160/CMP0160-OLD-stderr.txt
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
HEADER_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_HEADER_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
MANUALLY_ADDED_DEPENDENCIES property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
NAME property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
TYPE property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
IMPORTED_GLOBAL property can't be set on non-imported
|
||||||
|
targets\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
HEADER_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_HEADER_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
MANUALLY_ADDED_DEPENDENCIES property is read-only for
|
||||||
|
target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
NAME property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
TYPE property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
EXPORT_NAME property can't be set on imported targets\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
SOURCES property can't be set on imported targets\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-OLD.cmake:4 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
4
Tests/RunCMake/CMP0160/CMP0160-OLD.cmake
Normal file
4
Tests/RunCMake/CMP0160/CMP0160-OLD.cmake
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
project(ReadOnly LANGUAGES NONE)
|
||||||
|
cmake_policy(SET CMP0160 OLD)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/READONLY_PROPERTIES.cmake)
|
1
Tests/RunCMake/CMP0160/CMP0160-WARN-result.txt
Normal file
1
Tests/RunCMake/CMP0160/CMP0160-WARN-result.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
1
|
297
Tests/RunCMake/CMP0160/CMP0160-WARN-stderr.txt
Normal file
297
Tests/RunCMake/CMP0160/CMP0160-WARN-stderr.txt
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
HEADER_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_HEADER_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
MANUALLY_ADDED_DEPENDENCIES property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
NAME property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
TYPE property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
ALIAS_GLOBAL property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
BINARY_DIR property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
CXX_MODULE_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
IMPORTED property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
INTERFACE_CXX_MODULE_SETS property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
LOCATION property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
LOCATION_CONFIG property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
SOURCE_DIR property is read-only for target\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
IMPORTED_GLOBAL property can't be set on non-imported
|
||||||
|
targets\("ReadOnlyLib"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
HEADER_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
INTERFACE_HEADER_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
MANUALLY_ADDED_DEPENDENCIES property is read-only for
|
||||||
|
target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
NAME property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
TYPE property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
ALIAS_GLOBAL property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
BINARY_DIR property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
CXX_MODULE_SETS property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
IMPORTED property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
INTERFACE_CXX_MODULE_SETS property is read-only for
|
||||||
|
target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
LOCATION property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
LOCATION_CONFIG property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Warning \(dev\) at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
Policy CMP0160 is not set: More read-only target properties now error when
|
||||||
|
trying to set them. Run "cmake --help-policy CMP0160" for policy details.
|
||||||
|
Use the cmake_policy command to set the policy and suppress this warning.
|
||||||
|
|
||||||
|
SOURCE_DIR property is read-only for target\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
EXPORT_NAME property can't be set on imported targets\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
||||||
|
|
||||||
|
|
||||||
|
CMake Error at READONLY_PROPERTIES.cmake:44 \(set_target_properties\):
|
||||||
|
SOURCES property can't be set on imported targets\("ReadOnlyImport"\)
|
||||||
|
|
||||||
|
Call Stack \(most recent call first\):
|
||||||
|
CMP0160-WARN.cmake:3 \(include\)
|
||||||
|
CMakeLists.txt:3 \(include\)
|
3
Tests/RunCMake/CMP0160/CMP0160-WARN.cmake
Normal file
3
Tests/RunCMake/CMP0160/CMP0160-WARN.cmake
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
project(ReadOnly LANGUAGES NONE)
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/READONLY_PROPERTIES.cmake)
|
3
Tests/RunCMake/CMP0160/CMakeLists.txt
Normal file
3
Tests/RunCMake/CMP0160/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.28)
|
||||||
|
project(${RunCMake_TEST} NONE)
|
||||||
|
include(${RunCMake_TEST}.cmake)
|
52
Tests/RunCMake/CMP0160/READONLY_PROPERTIES.cmake
Normal file
52
Tests/RunCMake/CMP0160/READONLY_PROPERTIES.cmake
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
set(read_only_properties
|
||||||
|
"HEADER_SETS"
|
||||||
|
"INTERFACE_HEADER_SETS"
|
||||||
|
"MANUALLY_ADDED_DEPENDENCIES"
|
||||||
|
"NAME"
|
||||||
|
"TYPE"
|
||||||
|
)
|
||||||
|
set(read_only_properties_imported
|
||||||
|
"EXPORT_NAME"
|
||||||
|
"SOURCES"
|
||||||
|
)
|
||||||
|
set(read_only_properties_nonimported
|
||||||
|
"IMPORTED_GLOBAL"
|
||||||
|
)
|
||||||
|
set(read_only_properties_160
|
||||||
|
"ALIAS_GLOBAL"
|
||||||
|
"BINARY_DIR"
|
||||||
|
"CXX_MODULE_SETS"
|
||||||
|
"IMPORTED"
|
||||||
|
"INTERFACE_CXX_MODULE_SETS"
|
||||||
|
"LOCATION"
|
||||||
|
"LOCATION_CONFIG"
|
||||||
|
"SOURCE_DIR"
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_policy(GET CMP0160 policy160)
|
||||||
|
add_library(ReadOnlyLib )
|
||||||
|
add_library(ReadOnlyImport IMPORTED UNKNOWN)
|
||||||
|
|
||||||
|
foreach(target ReadOnlyLib ReadOnlyImport)
|
||||||
|
get_target_property(is_imported ${target} IMPORTED)
|
||||||
|
set(are_read_only ${read_only_properties})
|
||||||
|
if(NOT policy160 STREQUAL "OLD")
|
||||||
|
list(APPEND are_read_only ${read_only_properties_160})
|
||||||
|
endif()
|
||||||
|
if(is_imported)
|
||||||
|
list(APPEND are_read_only ${read_only_properties_imported})
|
||||||
|
else()
|
||||||
|
list(APPEND are_read_only ${read_only_properties_nonimported})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(prop IN LISTS are_read_only)
|
||||||
|
set_target_properties(${target} PROPERTIES ${prop} "a_value")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
if(policy160 STREQUAL "OLD")
|
||||||
|
foreach(prop IN LISTS read_only_properties_160)
|
||||||
|
set_target_properties(${target} PROPERTIES ${prop} "a_value")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
5
Tests/RunCMake/CMP0160/RunCMakeTest.cmake
Normal file
5
Tests/RunCMake/CMP0160/RunCMakeTest.cmake
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
include(RunCMake)
|
||||||
|
|
||||||
|
run_cmake(CMP0160-WARN)
|
||||||
|
run_cmake(CMP0160-OLD)
|
||||||
|
run_cmake(CMP0160-NEW)
|
@ -168,6 +168,7 @@ endif()
|
|||||||
add_RunCMake_test(CMP0153)
|
add_RunCMake_test(CMP0153)
|
||||||
add_RunCMake_test(CMP0156 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
|
add_RunCMake_test(CMP0156 -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}
|
||||||
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
|
-DCMAKE_C_COMPILER_VERSION=${CMAKE_C_COMPILER_VERSION})
|
||||||
|
add_RunCMake_test(CMP0160)
|
||||||
|
|
||||||
# The test for Policy 65 requires the use of the
|
# The test for Policy 65 requires the use of the
|
||||||
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
|
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
\* CMP0155
|
\* CMP0155
|
||||||
\* CMP0156
|
\* CMP0156
|
||||||
\* CMP0157
|
\* CMP0157
|
||||||
|
\* CMP0160
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:3 \(include\)
|
||||||
|
@ -23,8 +23,8 @@ Call Stack \(most recent call first\):
|
|||||||
|
|
||||||
|
|
||||||
CMake Error at IMPORTED_GLOBAL.cmake:32 \(set_property\):
|
CMake Error at IMPORTED_GLOBAL.cmake:32 \(set_property\):
|
||||||
IMPORTED_GLOBAL property can't be set on non-imported targets
|
IMPORTED_GLOBAL property can't be set on non-imported
|
||||||
\(\"NonImportedTarget\"\)
|
targets\(\"NonImportedTarget\"\)
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists\.txt:[0-9]+ \(include\)
|
CMakeLists\.txt:[0-9]+ \(include\)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
^CMake Error at FileSetReadOnlyInterface\.cmake:[0-9]+ \(set_property\):
|
^CMake Error at FileSetReadOnlyInterface\.cmake:[0-9]+ \(set_property\):
|
||||||
INTERFACE_HEADER_SETS property is read-only
|
INTERFACE_HEADER_SETS property is read-only for target\("lib1"\)
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
^CMake Error at FileSetReadOnlyPrivate\.cmake:[0-9]+ \(set_property\):
|
^CMake Error at FileSetReadOnlyPrivate\.cmake:[0-9]+ \(set_property\):
|
||||||
HEADER_SETS property is read-only
|
HEADER_SETS property is read-only for target\("lib1"\)
|
||||||
|
|
||||||
Call Stack \(most recent call first\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
CMakeLists\.txt:[0-9]+ \(include\)$
|
||||||
|
Loading…
Reference in New Issue
Block a user