1
0
Эх сурвалжийг харах

Merge topic 'read-only-type-target-property'

98f21433 cmTarget: Enforce TYPE being a read-only property
Brad King 8 жил өмнө
parent
commit
cda3a69b1b

+ 6 - 0
Source/cmTarget.cxx

@@ -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 (\""

+ 1 - 0
Tests/RunCMake/set_property/RunCMakeTest.cmake

@@ -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)

+ 1 - 0
Tests/RunCMake/set_property/TYPE-result.txt

@@ -0,0 +1 @@
+1

+ 1 - 0
Tests/RunCMake/set_property/TYPE-stderr.txt

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

+ 2 - 0
Tests/RunCMake/set_property/TYPE.cmake

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