diff options
author | Brad King <brad.king@kitware.com> | 2017-09-01 14:25:04 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-01 14:25:08 (GMT) |
commit | bd777178006c643bcab4bcbb1c5432f9306568ec (patch) | |
tree | 8c23d3567a138a9331bb5026506e37a7c2a5aa11 | |
parent | 9a509099f77ed32a0845e4e3fad7b8f1eb9be10b (diff) | |
parent | 068cc545d905a5b0fd8caa09494c04346d0ca936 (diff) | |
download | CMake-bd777178006c643bcab4bcbb1c5432f9306568ec.zip CMake-bd777178006c643bcab4bcbb1c5432f9306568ec.tar.gz CMake-bd777178006c643bcab4bcbb1c5432f9306568ec.tar.bz2 |
Merge topic 'fix-genex-SOURCES'
068cc545 Genex: Fix TARGET_PROPERTY value of SOURCES
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1218
6 files changed, 16 insertions, 1 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 4e412f3..74306b0 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -158,7 +158,7 @@ const char* cmGeneratorTarget::GetSourcesProperty() const } static std::string value; value.clear(); - value = cmJoin(values, ""); + value = cmJoin(values, ";"); return value.c_str(); } 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 |