summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-05-06 11:16:23 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-06 19:07:40 (GMT)
commitd648c4766ff56907bc17287077eeebcc9e40b184 (patch)
tree918f6ba2723c223212366a534c2726824a3d3626 /Tests
parentb8af20116854b51923da9ebef668fba0072b06c4 (diff)
downloadCMake-d648c4766ff56907bc17287077eeebcc9e40b184.zip
CMake-d648c4766ff56907bc17287077eeebcc9e40b184.tar.gz
CMake-d648c4766ff56907bc17287077eeebcc9e40b184.tar.bz2
cmTarget: Don't assert on object libraries for configure-time location.
Commit b8af2011 (cmTarget: Fix listing of source files at configure-time., 2014-04-13) refactored a GetObjectLibrariesCMP0026 method out of GetLanguages. In flight, a conditional use of a target if available was changed to an assert-available. This code is only used to read the LOCATION property at configure time, when the link information is incomplete, and not all targets are defined, so the assert is inappropriate, even though it can lead to incorrect information being generated. CMP0026 warns about the potentially incorrect information anyway.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt1
-rw-r--r--Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt12
-rw-r--r--Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake13
-rw-r--r--Tests/RunCMake/CMP0026/RunCMakeTest.cmake1
4 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt
new file mode 100644
index 0000000..87d198d
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined-stderr.txt
@@ -0,0 +1,12 @@
+CMake Warning \(dev\) at ObjlibNotDefined.cmake:[0-9]+ \(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 "objlibuser". 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/ObjlibNotDefined.cmake b/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake
new file mode 100644
index 0000000..194760c
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/ObjlibNotDefined.cmake
@@ -0,0 +1,13 @@
+
+enable_language(CXX)
+
+add_executable(objlibuser
+ empty.cpp
+ $<TARGET_OBJECTS:bar>
+)
+
+get_target_property(_location objlibuser LOCATION)
+
+add_library(bar OBJECT
+ empty.cpp
+)
diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
index 1824cc6..7c2582f 100644
--- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
@@ -9,3 +9,4 @@ run_cmake(CMP0026-CONFIG-LOCATION-WARN)
run_cmake(CMP0026-LOCATION-CONFIG-NEW)
run_cmake(CMP0026-LOCATION-CONFIG-OLD)
run_cmake(CMP0026-LOCATION-CONFIG-WARN)
+run_cmake(ObjlibNotDefined)