diff options
author | Brad King <brad.king@kitware.com> | 2014-05-09 14:50:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-05-09 15:24:15 (GMT) |
commit | 911cc9a39e1f26344d47743885626060c2d94d2c (patch) | |
tree | a0199eb310d875d3a891cbf78224f79893750b6f /Tests/RunCMake/CMP0026 | |
parent | cb810abe6d1c4189517d84fa6e08849a02e3f873 (diff) | |
download | CMake-911cc9a39e1f26344d47743885626060c2d94d2c.zip CMake-911cc9a39e1f26344d47743885626060c2d94d2c.tar.gz CMake-911cc9a39e1f26344d47743885626060c2d94d2c.tar.bz2 |
cmTarget: Evaluate CMP0026 and CMP0051 in calling context
These policies should be checked at the call site that tries to access
the LOCATION or SOURCES property, not the directory scope containing the
target. Thread the caller context through cmTarget::GetProperty to use
for checking the policy setting and emitting a diagnostic with proper
backtrace.
Extend the RunCMake.CMP0026 and RunCMake.CMP0051 tests with
cross-directory cases.
Diffstat (limited to 'Tests/RunCMake/CMP0026')
-rw-r--r-- | Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt | 13 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0026/CMP0026-WARN.cmake | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt new file mode 100644 index 0000000..17a7db0 --- /dev/null +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-Dir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(otherlib ../empty.cpp) diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt index 9b88194..d122c4a 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN-stderr.txt @@ -10,3 +10,16 @@ CMake Warning \(dev\) at CMP0026-WARN.cmake:5 \(get_target_property\): Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0026-WARN.cmake:8 \(get_target_property\): + Policy CMP0026 is not set: Disallow use of the LOCATION target property. + Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + The LOCATION property should not be read from target "otherlib". Use the + target name directly with add_custom_command, or use the generator + expression \$<TARGET_FILE>, as appropriate. + +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake index 89c5a8a..bfc9203 100644 --- a/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake +++ b/Tests/RunCMake/CMP0026/CMP0026-WARN.cmake @@ -3,3 +3,6 @@ enable_language(CXX) add_library(somelib empty.cpp) get_target_property(_loc somelib LOCATION) + +add_subdirectory(CMP0026-WARN-Dir) +get_target_property(_loc otherlib LOCATION) |