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.
This commit is contained in:
Brad King 2015-05-26 11:51:34 -04:00
parent 12b9005d7c
commit 89253992b8
4 changed files with 34 additions and 0 deletions

View File

@ -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\)

View File

@ -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>
)

View File

@ -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)