浏览代码

Tests: Add case for rejecting $<TARGET_FILE:...> on an INTERFACE library

Add an explicit test for this existing error.  We already cover it for
an OBJECT library but INTERFACE libraries are not allowed either.
Brad King 10 年之前
父节点
当前提交
89253992b8

+ 1 - 0
Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-result.txt

@@ -0,0 +1 @@
+1

+ 26 - 0
Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface-stderr.txt

@@ -0,0 +1,26 @@
+CMake Error at BadTargetTypeInterface.cmake:[0-9]+ \(add_custom_target\):
+  Error evaluating generator expression:
+
+    \$<TARGET_FILE:iface>
+
+  Target "iface" is not an executable or library.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at BadTargetTypeInterface.cmake:[0-9]+ \(add_custom_target\):
+  Error evaluating generator expression:
+
+    \$<TARGET_SONAME_FILE:iface>
+
+  Target "iface" is not an executable or library.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Error at BadTargetTypeInterface.cmake:[0-9]+ \(add_custom_target\):
+  Error evaluating generator expression:
+
+    \$<TARGET_LINKER_FILE:iface>
+
+  Target "iface" is not an executable or library.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)

+ 6 - 0
Tests/RunCMake/GeneratorExpression/BadTargetTypeInterface.cmake

@@ -0,0 +1,6 @@
+add_library(iface INTERFACE)
+add_custom_target(check ALL COMMAND echo
+  $<TARGET_FILE:iface>
+  $<TARGET_SONAME_FILE:iface>
+  $<TARGET_LINKER_FILE:iface>
+  )

+ 1 - 0
Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake

@@ -7,6 +7,7 @@ run_cmake(BadNOT)
 run_cmake(BadStrEqual)
 run_cmake(BadZero)
 run_cmake(BadTargetName)
+run_cmake(BadTargetTypeInterface)
 run_cmake(BadTargetTypeObject)
 run_cmake(BadInstallPrefix)
 run_cmake(CMP0044-WARN)