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 | |
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')
-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 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt | 18 | ||||
-rw-r--r-- | Tests/RunCMake/CMP0051/CMP0051-WARN.cmake | 6 |
6 files changed, 41 insertions, 1 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) diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt new file mode 100644 index 0000000..77cbad5 --- /dev/null +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-Dir/CMakeLists.txt @@ -0,0 +1 @@ +add_library(empty2 ../empty.cpp $<TARGET_OBJECTS:objects>) diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt index f1b0357..ae2e468 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN-stderr.txt @@ -12,4 +12,20 @@ Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) This warning is for project developers. Use -Wno-dev to suppress it. -Sources: "empty.cpp"$ +Sources: "empty.cpp" +* +CMake Warning \(dev\) at CMP0051-WARN.cmake:12 \(get_target_property\): + Policy CMP0051 is not set: List TARGET_OBJECTS in SOURCES target property. + Run "cmake --help-policy CMP0051" for policy details. Use the cmake_policy + command to set the policy and suppress this warning. + + Target "empty2" contains \$<TARGET_OBJECTS> generator expression in its + sources list. This content was not previously part of the SOURCES property + when that property was read at configure time. Code reading that property + needs to be adapted to ignore the generator expression using the + string\(GENEX_STRIP\) command. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +Sources: "../empty.cpp"$ diff --git a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake index fd595ce..744598f 100644 --- a/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake +++ b/Tests/RunCMake/CMP0051/CMP0051-WARN.cmake @@ -6,3 +6,9 @@ add_library(empty empty.cpp $<TARGET_OBJECTS:objects>) get_target_property(srcs empty SOURCES) message("Sources: \"${srcs}\"") + +add_subdirectory(CMP0051-WARN-Dir) + +get_target_property(srcs empty2 SOURCES) + +message("Sources: \"${srcs}\"") |