diff options
author | Brad King <brad.king@kitware.com> | 2017-01-09 21:27:25 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2017-01-09 21:27:25 (GMT) |
commit | cda3a69b1bcc2e83806f7423c6970a794be8261f (patch) | |
tree | a4aadaa027c7519f43dabd6568f35c6990979608 | |
parent | 0dabeb6024b352bc7d5f9e1dce63ad87186ce36f (diff) | |
parent | 98f2143305b8b8c5ce08dfa38ee79750696865a6 (diff) | |
download | CMake-cda3a69b1bcc2e83806f7423c6970a794be8261f.zip CMake-cda3a69b1bcc2e83806f7423c6970a794be8261f.tar.gz CMake-cda3a69b1bcc2e83806f7423c6970a794be8261f.tar.bz2 |
Merge topic 'read-only-type-target-property'
98f21433 cmTarget: Enforce TYPE being a read-only property
-rw-r--r-- | Source/cmTarget.cxx | 6 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/TYPE-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/TYPE-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/TYPE.cmake | 2 |
5 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ee4ff39..9261ca8 100644 --- a/Source/cmTarget.cxx +++ b/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 (\"" diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake index 37c7124..1ddacee 100644 --- a/Tests/RunCMake/set_property/RunCMakeTest.cmake +++ b/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) diff --git a/Tests/RunCMake/set_property/TYPE-result.txt b/Tests/RunCMake/set_property/TYPE-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/set_property/TYPE-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/set_property/TYPE-stderr.txt b/Tests/RunCMake/set_property/TYPE-stderr.txt new file mode 100644 index 0000000..fbc8653 --- /dev/null +++ b/Tests/RunCMake/set_property/TYPE-stderr.txt @@ -0,0 +1 @@ +TYPE property is read-only diff --git a/Tests/RunCMake/set_property/TYPE.cmake b/Tests/RunCMake/set_property/TYPE.cmake new file mode 100644 index 0000000..8481266 --- /dev/null +++ b/Tests/RunCMake/set_property/TYPE.cmake @@ -0,0 +1,2 @@ +add_custom_target(CustomTarget) +set_property(TARGET CustomTarget PROPERTY TYPE foo) |