summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CMP0026
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-17 13:29:49 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-17 14:10:15 (GMT)
commit5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3 (patch)
tree0a0e49bb95bcdddb5f548e0416221d88920e1fe2 /Tests/RunCMake/CMP0026
parent60307c5056476962d7656ea9122ada79a07aa58f (diff)
downloadCMake-5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3.zip
CMake-5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3.tar.gz
CMake-5e616fcf9ac1675fa4f3e7c1dc7f0e3dfb014df3.tar.bz2
CMP0026: Fix OLD behavior with file written during configure step
Refactoring in commit 60307c5056 (cmGeneratorTarget: Replace source classifier implementation, 2017-04-07) accidentally regressed support for CMP0026's OLD behavior in the case of a source file written by project code during the configure step after getting a LOCATION. We should not perform full source classification until the generate step because files written by the project's configure step may not exist yet. Add special logic to support this case. Add a test case for it. Reported-by: David Stoup <david.stoup@kitware.com>
Diffstat (limited to 'Tests/RunCMake/CMP0026')
-rw-r--r--Tests/RunCMake/CMP0026/CMP0026-OLD.cmake12
-rw-r--r--Tests/RunCMake/CMP0026/RunCMakeTest.cmake1
2 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake b/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake
new file mode 100644
index 0000000..80497a3
--- /dev/null
+++ b/Tests/RunCMake/CMP0026/CMP0026-OLD.cmake
@@ -0,0 +1,12 @@
+enable_language(CXX)
+
+cmake_policy(SET CMP0026 OLD)
+
+set(out ${CMAKE_CURRENT_BINARY_DIR}/out.txt)
+
+add_library(somelib empty.cpp ${out})
+get_target_property(_loc somelib LOCATION)
+
+file(WRITE "${out}"
+ "source file written by project code after getting target LOCATION\n"
+ )
diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
index 6331717..047da28 100644
--- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake
@@ -1,6 +1,7 @@
include(RunCMake)
run_cmake(CMP0026-WARN)
+run_cmake(CMP0026-OLD)
run_cmake(CMP0026-NEW)
run_cmake(CMP0026-IMPORTED)
run_cmake(CMP0026-CONFIG-LOCATION-NEW)