summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-09-01 14:24:12 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-01 14:24:12 (GMT)
commit2820de210b0334307d5aea8fcbf9fff43cd43e58 (patch)
treef4ca89eca518821a715ac7cc0365430676a727ca /Tests
parent29907992277e0145a83368f3e8674b0608d745c5 (diff)
parent068cc545d905a5b0fd8caa09494c04346d0ca936 (diff)
downloadCMake-2820de210b0334307d5aea8fcbf9fff43cd43e58.zip
CMake-2820de210b0334307d5aea8fcbf9fff43cd43e58.tar.gz
CMake-2820de210b0334307d5aea8fcbf9fff43cd43e58.tar.bz2
Merge branch 'fix-genex-SOURCES' into release-3.9
Merge-request: !1218
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake9
-rw-r--r--Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake5
-rw-r--r--Tests/RunCMake/GeneratorExpression/empty2.c0
-rw-r--r--Tests/RunCMake/GeneratorExpression/empty3.c0
5 files changed, 15 insertions, 0 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 63cd2da..2486259 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -32,6 +32,7 @@ run_cmake(COMPILE_LANGUAGE-unknown-lang)
run_cmake(TARGET_FILE-recursion)
run_cmake(OUTPUT_NAME-recursion)
run_cmake(TARGET_PROPERTY-LOCATION)
+run_cmake(TARGET_PROPERTY-SOURCES)
run_cmake(LINK_ONLY-not-linking)
run_cmake(ImportedTarget-TARGET_BUNDLE_DIR)
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake
new file mode 100644
index 0000000..f1452b5
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake
@@ -0,0 +1,9 @@
+file(READ ${RunCMake_TEST_BINARY_DIR}/foo.txt foo_sources)
+
+# VS generators inject CMakeLists.txt as a source. Remove it.
+string(REGEX REPLACE ";[^;]*CMakeLists.txt$" "" foo_sources "${foo_sources}")
+
+set(foo_expected "empty.c;empty2.c;empty3.c")
+if(NOT foo_sources STREQUAL foo_expected)
+ set(RunCMake_TEST_FAILED "foo SOURCES was:\n [[${foo_sources}]]\nbut expected:\n [[${foo_expected}]]")
+endif()
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake
new file mode 100644
index 0000000..dee7ead
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES.cmake
@@ -0,0 +1,5 @@
+cmake_policy(SET CMP0070 NEW)
+enable_language(C)
+add_library(foo empty.c empty2.c)
+target_sources(foo PRIVATE empty3.c)
+file(GENERATE OUTPUT foo.txt CONTENT "$<TARGET_PROPERTY:foo,SOURCES>")
diff --git a/Tests/RunCMake/GeneratorExpression/empty2.c b/Tests/RunCMake/GeneratorExpression/empty2.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/empty2.c
diff --git a/Tests/RunCMake/GeneratorExpression/empty3.c b/Tests/RunCMake/GeneratorExpression/empty3.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/empty3.c