cmTarget: Enforce TYPE being a read-only property

This commit is contained in:
Gregor Jasny 2016-12-29 23:11:50 +01:00 committed by Brad King
parent 2da3ae3bf7
commit 98f2143305
5 changed files with 11 additions and 0 deletions

View File

@ -858,6 +858,12 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
if (prop == "TYPE") {
std::ostringstream e;
e << "TYPE property is read-only\n";
this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
return;
}
if (prop == "EXPORT_NAME" && this->IsImported()) {
std::ostringstream e;
e << "EXPORT_NAME property can't be set on imported targets (\""

View File

@ -6,4 +6,5 @@ run_cmake(COMPILE_OPTIONS)
run_cmake(INCLUDE_DIRECTORIES)
run_cmake(LINK_LIBRARIES)
run_cmake(SOURCES)
run_cmake(TYPE)
run_cmake(USER_PROP)

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
TYPE property is read-only

View File

@ -0,0 +1,2 @@
add_custom_target(CustomTarget)
set_property(TARGET CustomTarget PROPERTY TYPE foo)