diff options
author | Brad King <brad.king@kitware.com> | 2017-10-18 17:30:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-10-18 18:24:07 (GMT) |
commit | 344d149ae45251125f3dad038d9f10e531eb6fd1 (patch) | |
tree | fc945d8bc8a6b4239b2125bf55ae3b9b193f87ef /Tests | |
parent | 6dec363028ad969fb1a7b160e42ab815ccbb60ca (diff) | |
download | CMake-344d149ae45251125f3dad038d9f10e531eb6fd1.zip CMake-344d149ae45251125f3dad038d9f10e531eb6fd1.tar.gz CMake-344d149ae45251125f3dad038d9f10e531eb6fd1.tar.bz2 |
VS,Xcode: Add CMakeLists.txt sources without mutating targets
Rather than injecting `CMakeLists.txt` files into each target's
`SOURCES`, teach the generators to add them during generation using
dedicated code. This avoids mutating the original targets, and avoids
polluting `$<TARGET_PROPERTY:foo,SOURCES>` with generator-specific
content.
This also avoids listing the `CMakeLists.txt` sources in the results of
`CMAKE_DEBUG_TARGET_PROPERTIES==SOURCES` so the `RunCMake.TargetSources`
test no longer needs a separate case for IDEs.
Diffstat (limited to 'Tests')
6 files changed, 1 insertions, 53 deletions
diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake index f1452b5..c1a0f5b 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-SOURCES-check.cmake @@ -1,8 +1,5 @@ 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}]]") diff --git a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt index 1de5dd7..c6b75fc 100644 --- a/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt +++ b/Tests/RunCMake/TargetSources/ConfigNotAllowed-stderr.txt @@ -6,9 +6,7 @@ CMake Error in CMakeLists.txt: .*/Tests/RunCMake/TargetSources/empty_1.cpp .*/Tests/RunCMake/TargetSources/empty_2.cpp - .*/Tests/RunCMake/TargetSources/CMakeLists.txt Config "Release": .*/Tests/RunCMake/TargetSources/empty_1.cpp - .*/Tests/RunCMake/TargetSources/CMakeLists.txt diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt deleted file mode 100644 index 573541a..0000000 --- a/Tests/RunCMake/TargetSources/OriginDebugIDE-result.txt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt b/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt deleted file mode 100644 index 6fdcce7..0000000 --- a/Tests/RunCMake/TargetSources/OriginDebugIDE-stderr.txt +++ /dev/null @@ -1,40 +0,0 @@ -CMake Debug Log at OriginDebug.cmake:13 \(add_library\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_2.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) -+ -CMake Debug Log at OriginDebug.cmake:16 \(set_property\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_3.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) -+ -CMake Debug Log at OriginDebug.cmake:20 \(target_sources\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_4.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) -+ -CMake Debug Log in CMakeLists.txt: - Used sources for target OriginDebug: - - * .*CMakeLists.txt -+ -CMake Debug Log at OriginDebug.cmake:14 \(target_link_libraries\): - Used sources for target OriginDebug: - - \* .*Tests/RunCMake/TargetSources/empty_1.cpp - -Call Stack \(most recent call first\): - OriginDebugIDE.cmake:4 \(include\) - CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake b/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake deleted file mode 100644 index a3cc3a8..0000000 --- a/Tests/RunCMake/TargetSources/OriginDebugIDE.cmake +++ /dev/null @@ -1,4 +0,0 @@ - -# Separate test for the IDEs, because they show the CMakeLists.txt file -# as a source file. -include(${CMAKE_CURRENT_LIST_DIR}/OriginDebug.cmake) diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake index bb55a6e..36d01de 100644 --- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake +++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake @@ -2,11 +2,9 @@ include(RunCMake) if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode") run_cmake(ConfigNotAllowed) - run_cmake(OriginDebugIDE) -else() - run_cmake(OriginDebug) endif() +run_cmake(OriginDebug) run_cmake(CMP0026-LOCATION) run_cmake(RelativePathInInterface) run_cmake(ExportBuild) |