summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/MathTest/CMakeLists.txt33
-rw-r--r--Tests/MathTest/MathTestExec.cxx40
-rw-r--r--Tests/RunCMake/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/math/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-DivideByZero.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-DoubleOption.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt6
-rw-r--r--Tests/RunCMake/math/MATH-InvalidExpression.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-TooManyArguments.cmake1
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument-result.txt1
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument-stderr.txt4
-rw-r--r--Tests/RunCMake/math/MATH-WrongArgument.cmake1
-rw-r--r--Tests/RunCMake/math/MATH.cmake12
-rw-r--r--Tests/RunCMake/math/RunCMakeTest.cmake8
-rw-r--r--Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake3
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt4
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake17
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt13
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt2
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake11
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt2
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake11
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt1
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt5
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt2
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget.cmake10
-rw-r--r--Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt6
36 files changed, 121 insertions, 109 deletions
diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt
index f764b3a..5403d29 100644
--- a/Tests/MathTest/CMakeLists.txt
+++ b/Tests/MathTest/CMakeLists.txt
@@ -13,14 +13,35 @@ set(expressions
"-1 + +1"
"+1 - -1"
"+1 - - + + -(-3 + - - +1)"
+ "1000 -12*5"
+ "1000 +12*-5"
+ "1000 -12*-5"
)
-set(FILE_EXPRESSIONS "")
-foreach(expression
- ${expressions})
- math(EXPR expr "${expression}")
- string(APPEND FILE_EXPRESSIONS "TEST_EXPRESSION(${expression}, ${expr})\n")
-endforeach()
+set(FILE_EXPRESSIONS "extern void test_expression(int x, int y, const char * text);\n")
+
+
+macro(add_math_test expression)
+ math(EXPR result ${expression} ${ARGV1} ${ARGV2})
+ set(CODE "test_expression(${expression}, ${result}, \"${expression}\");")
+ string(APPEND FILE_EXPRESSIONS "${CODE}\n")
+endmacro()
+
+macro(add_math_tests)
+ foreach (expression ${expressions})
+ add_math_test(${expression} ${ARGV0} ${ARGV1})
+ endforeach ()
+endmacro()
+
+add_math_tests()
+add_math_tests("OUTPUT_FORMAT" "DECIMAL")
+add_math_tests("OUTPUT_FORMAT" "HEXADECIMAL")
+
+# Avoid the test with negative result and hexadecimal formatting
+# therefore more tests with a negative result
+add_math_test("-12*5")
+add_math_test("12*-5")
+
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/MathTestTests.h.in"
diff --git a/Tests/MathTest/MathTestExec.cxx b/Tests/MathTest/MathTestExec.cxx
index 124eba4..fbcddc4 100644
--- a/Tests/MathTest/MathTestExec.cxx
+++ b/Tests/MathTest/MathTestExec.cxx
@@ -1,21 +1,43 @@
#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
-#define TEST_EXPRESSION(x, y) \
- if ((x) != (y)) { \
- printf("Problem with EXPR: Expression: \"%s\" in C returns %d while in " \
- "CMake returns: %d\n", \
- #x, (x), (y)); \
- res++; \
+int res = 0;
+bool print = false;
+
+void test_expression(int x, int y, const char* text)
+{
+ bool fail = (x) != (y);
+ if (fail) {
+ res++;
+ printf("Problem with EXPR:");
+ }
+ if (fail || print) {
+ printf("Expression: \"%s\" in CMake returns %d", text, (y));
+ if (fail) {
+ printf(" while in C returns: %d", (x));
+ }
+ printf("\n");
}
+}
int main(int argc, char* argv[])
{
- if (argc > 1) {
- printf("Usage: %s\n", argv[0]);
+ if (argc > 2) {
+ printf("Usage: %s [print]\n", argv[0]);
return 1;
}
- int res = 0;
+
+ if (argc > 1) {
+ if (strcmp(argv[1], "print") != 0) {
+ printf("Usage: %s [print]\n", argv[0]);
+ return 1;
+ }
+ print = true;
+ }
+
#include "MathTestTests.h"
+
if (res != 0) {
printf("%s: %d math tests failed\n", argv[0], res);
return 1;
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index dcc7c98..c211f99 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -238,6 +238,7 @@ add_RunCMake_test(include)
add_RunCMake_test(include_directories)
add_RunCMake_test(include_guard)
add_RunCMake_test(list)
+add_RunCMake_test(math)
add_RunCMake_test(message)
add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES})
add_RunCMake_test(return)
diff --git a/Tests/RunCMake/math/CMakeLists.txt b/Tests/RunCMake/math/CMakeLists.txt
new file mode 100644
index 0000000..12cd3c7
--- /dev/null
+++ b/Tests/RunCMake/math/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8.4)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/math/MATH-DivideByZero-result.txt b/Tests/RunCMake/math/MATH-DivideByZero-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt
new file mode 100644
index 0000000..66ad633
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-DivideByZero.cmake:1 \(math\):
+ math cannot evaluate the expression: "100/0": divide by zero.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-DivideByZero.cmake b/Tests/RunCMake/math/MATH-DivideByZero.cmake
new file mode 100644
index 0000000..3ac161e
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DivideByZero.cmake
@@ -0,0 +1 @@
+math(EXPR var "100/0")
diff --git a/Tests/RunCMake/math/MATH-DoubleOption-result.txt b/Tests/RunCMake/math/MATH-DoubleOption-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt
new file mode 100644
index 0000000..767a060
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-DoubleOption.cmake:1 \(math\):
+ math EXPR called with incorrect arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-DoubleOption.cmake b/Tests/RunCMake/math/MATH-DoubleOption.cmake
new file mode 100644
index 0000000..7bcb78e
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-DoubleOption.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT HEXADECIMAL)
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-result.txt b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
new file mode 100644
index 0000000..18ac9f7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at MATH-InvalidExpression.cmake:1 \(math\):
+ *math cannot parse the expression: "INVALID": syntax error, unexpected
+ *character, expecting exp_PLUS or exp_MINUS or exp_OPENPARENT or exp_NUMBER
+ *\(1\).
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-InvalidExpression.cmake b/Tests/RunCMake/math/MATH-InvalidExpression.cmake
new file mode 100644
index 0000000..6e37128
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-InvalidExpression.cmake
@@ -0,0 +1 @@
+math(EXPR var "INVALID")
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-result.txt b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt
new file mode 100644
index 0000000..fdcfecf
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-TooManyArguments.cmake:1 \(math\):
+ math EXPR called with incorrect arguments.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-TooManyArguments.cmake b/Tests/RunCMake/math/MATH-TooManyArguments.cmake
new file mode 100644
index 0000000..969dc80
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-TooManyArguments.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUTPUT_FORMAT DECIMAL OUTPUT_FORMAT )
diff --git a/Tests/RunCMake/math/MATH-WrongArgument-result.txt b/Tests/RunCMake/math/MATH-WrongArgument-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt
new file mode 100644
index 0000000..bbe54bf
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at MATH-WrongArgument.cmake:1 \(math\):
+ math sub-command EXPR option "OUT" is unknown.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/math/MATH-WrongArgument.cmake b/Tests/RunCMake/math/MATH-WrongArgument.cmake
new file mode 100644
index 0000000..fb6d2e7
--- /dev/null
+++ b/Tests/RunCMake/math/MATH-WrongArgument.cmake
@@ -0,0 +1 @@
+math(EXPR var "10*10" OUT HEX )
diff --git a/Tests/RunCMake/math/MATH.cmake b/Tests/RunCMake/math/MATH.cmake
new file mode 100644
index 0000000..a5f50cd
--- /dev/null
+++ b/Tests/RunCMake/math/MATH.cmake
@@ -0,0 +1,12 @@
+macro(math_test expression expected)
+ math(EXPR evaluated ${expression} ${ARGN})
+ if (NOT evaluated STREQUAL ${expected})
+ message(FATAL_ERROR "wrong math result: ${evaluated} != ${expected}")
+ endif ()
+endmacro()
+
+
+math_test("100 * 10" 1000)
+math_test("100 * 10" 1000 OUTPUT_FORMAT DECIMAL)
+math_test("100 * 0xA" 1000 OUTPUT_FORMAT DECIMAL)
+math_test("100 * 0xA" 0x3e8 OUTPUT_FORMAT HEXADECIMAL)
diff --git a/Tests/RunCMake/math/RunCMakeTest.cmake b/Tests/RunCMake/math/RunCMakeTest.cmake
new file mode 100644
index 0000000..494b813
--- /dev/null
+++ b/Tests/RunCMake/math/RunCMakeTest.cmake
@@ -0,0 +1,8 @@
+include(RunCMake)
+
+run_cmake(MATH)
+run_cmake(MATH-WrongArgument)
+run_cmake(MATH-DoubleOption)
+run_cmake(MATH-TooManyArguments)
+run_cmake(MATH-InvalidExpression)
+run_cmake(MATH-DivideByZero)
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
index d61fa5f..97b0888 100644
--- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
+++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake
@@ -8,10 +8,7 @@ run_cmake(ImportedTarget)
run_cmake(ImportedTargetFailure)
run_cmake(MixedSignature)
run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses)
-run_cmake(SubDirImportedTarget)
run_cmake(SubDirTarget)
-run_cmake(SubDirTarget-UNKNOWN-IMPORTED)
-run_cmake(SubDirTarget-UNKNOWN-IMPORTED-GLOBAL)
run_cmake(SharedDepNotTarget)
run_cmake(StaticPrivateDepNotExported)
run_cmake(StaticPrivateDepNotTarget)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt
deleted file mode 100644
index a7ef260..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt
+++ /dev/null
@@ -1,4 +0,0 @@
--- mainexeUnknownImportedGlobal: mainlib;sublib
--- mainlibUnknownImportedGlobal: mainlib;sublib
--- subexeUnknownImportedGlobal: mainlib;sublib
--- sublibUnknownImportedGlobal: mainlib;sublib
diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake
deleted file mode 100644
index 738280b..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-enable_language(C)
-
-add_executable(mainexeUnknownImportedGlobal IMPORTED GLOBAL)
-add_library(mainlibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL)
-add_library(mainlib empty.c)
-
-add_subdirectory(SubDirImportedTarget)
-
-target_link_libraries(subexeUnknownImportedGlobal INTERFACE mainlib)
-target_link_libraries(subexeUnknownImportedGlobal INTERFACE sublib)
-get_property(subexeUnknownImportedGlobal_libs TARGET subexeUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "subexeUnknownImportedGlobal: ${subexeUnknownImportedGlobal_libs}")
-
-target_link_libraries(sublibUnknownImportedGlobal INTERFACE mainlib)
-target_link_libraries(sublibUnknownImportedGlobal INTERFACE sublib)
-get_property(sublibUnknownImportedGlobal_libs TARGET sublibUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "sublibUnknownImportedGlobal: ${sublibUnknownImportedGlobal_libs}")
diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt
deleted file mode 100644
index d67a01c..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-add_executable(subexeUnknownImportedGlobal IMPORTED GLOBAL)
-add_library(sublibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL)
-add_library(sublib ../empty.c)
-
-target_link_libraries(mainexeUnknownImportedGlobal INTERFACE mainlib)
-target_link_libraries(mainexeUnknownImportedGlobal INTERFACE sublib)
-get_property(mainexeUnknownImportedGlobal_libs TARGET mainexeUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "mainexeUnknownImportedGlobal: ${mainexeUnknownImportedGlobal_libs}")
-
-target_link_libraries(mainlibUnknownImportedGlobal INTERFACE mainlib)
-target_link_libraries(mainlibUnknownImportedGlobal INTERFACE sublib)
-get_property(mainlibUnknownImportedGlobal_libs TARGET mainlibUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "mainlibUnknownImportedGlobal: ${mainlibUnknownImportedGlobal_libs}")
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt
deleted file mode 100644
index a8c77cb..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
--- mainexe: mainlibUnknownImportedGlobal;sublibUnknownImportedGlobal
--- subexe: mainlibUnknownImportedGlobal;sublibUnknownImportedGlobal
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake
deleted file mode 100644
index 04d64e6..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-enable_language(C)
-
-add_executable(mainexe empty.c)
-add_library(mainlibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL)
-
-add_subdirectory(SubDirTarget-UNKNOWN-IMPORTED-GLOBAL)
-
-target_link_libraries(subexe mainlibUnknownImportedGlobal)
-target_link_libraries(subexe sublibUnknownImportedGlobal)
-get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "subexe: ${subexe_libs}")
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt
deleted file mode 100644
index 6c0c8b2..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-add_executable(subexe ../empty.c)
-add_library(sublibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL)
-
-target_link_libraries(mainexe mainlibUnknownImportedGlobal)
-target_link_libraries(mainexe sublibUnknownImportedGlobal)
-get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "mainexe: ${mainexe_libs}")
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt
deleted file mode 100644
index 4980dc9..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
--- mainexe: mainlibUnknownImported;sublibUnknownImported
--- subexe: mainlibUnknownImported;sublibUnknownImported
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake
deleted file mode 100644
index e476a3f..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-enable_language(C)
-
-add_executable(mainexe empty.c)
-add_library(mainlibUnknownImported UNKNOWN IMPORTED)
-
-add_subdirectory(SubDirTarget-UNKNOWN-IMPORTED)
-
-target_link_libraries(subexe mainlibUnknownImported)
-target_link_libraries(subexe sublibUnknownImported)
-get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "subexe: ${subexe_libs}")
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt
deleted file mode 100644
index 4a40a68..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-add_executable(subexe ../empty.c)
-add_library(sublibUnknownImported UNKNOWN IMPORTED)
-
-target_link_libraries(mainexe mainlibUnknownImported)
-target_link_libraries(mainexe sublibUnknownImported)
-get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "mainexe: ${mainexe_libs}")
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
new file mode 100644
index 0000000..5cd1f23
--- /dev/null
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\):
+ Attempt to add link library "m" to target "subexe" which is not built in
+ this directory.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt
deleted file mode 100644
index 646f984..0000000
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
--- mainexe: mainlib;sublib
--- subexe: mainlib;sublib
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
index 55c658d..32431ce 100644
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake
@@ -1,11 +1,3 @@
enable_language(C)
-
-add_executable(mainexe empty.c)
-add_library(mainlib empty.c)
-
add_subdirectory(SubDirTarget)
-
-target_link_libraries(subexe mainlib)
-target_link_libraries(subexe sublib)
-get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "subexe: ${subexe_libs}")
+target_link_libraries(subexe m)
diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
index 3d956a8..b0b2380 100644
--- a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
+++ b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt
@@ -1,7 +1 @@
add_executable(subexe ../empty.c)
-add_library(sublib ../empty.c)
-
-target_link_libraries(mainexe mainlib)
-target_link_libraries(mainexe sublib)
-get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES)
-message(STATUS "mainexe: ${mainexe_libs}")