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:12:48 (GMT) |
commit | 23409f50f13a337333021b458a42273464100eae (patch) | |
tree | 66f0342306d147defd4cea0c307fc8b4e6e899b1 /Tests | |
parent | 2e75bf672b0d8e58972f9445a0ef475d21dbe87f (diff) | |
download | CMake-23409f50f13a337333021b458a42273464100eae.zip CMake-23409f50f13a337333021b458a42273464100eae.tar.gz CMake-23409f50f13a337333021b458a42273464100eae.tar.bz2 |
cmTarget: Evaluate CMP0026 in calling context
This policy should be checked at the call site that tries to access the
LOCATION 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 test with a cross-directory case.
Diffstat (limited to 'Tests')
-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) |