summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-14 13:50:34 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-14 13:50:34 (GMT)
commit332ee3e305f017a2991b2ae348644141d1539f61 (patch)
treed64aafd9622a05d4f6afa0d42b7c15d95ade895a /Tests
parentee58e94d62e33a06625f09b6a89ff3bbdeaf510e (diff)
downloadCMake-332ee3e305f017a2991b2ae348644141d1539f61.zip
CMake-332ee3e305f017a2991b2ae348644141d1539f61.tar.gz
CMake-332ee3e305f017a2991b2ae348644141d1539f61.tar.bz2
Tests: Fix CheckSourceTree test when build is under source (#15566)
Since the build tree will populate content under the source tree the test cannot reliably check that the source tree is pristine. Simply skip most of the test in this case.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeTests/CheckSourceTreeTest.cmake.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
index 33fe5f3..8145db7 100644
--- a/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
+++ b/Tests/CMakeTests/CheckSourceTreeTest.cmake.in
@@ -16,8 +16,13 @@ string(REPLACE "\\" "\\\\" HOME "${HOME}")
# (i.e. - is it an "in source" build?)
#
set(in_source_build 0)
+set(build_under_source 0)
-if(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
+string(FIND "${CMake_BINARY_DIR}" "${CMake_SOURCE_DIR}/" pos)
+if(pos EQUAL 0)
+ message("build dir is *inside* source dir")
+ set(build_under_source 1)
+elseif(CMake_SOURCE_DIR STREQUAL "${CMake_BINARY_DIR}")
message("build dir *is* source dir")
set(in_source_build 1)
else()
@@ -39,8 +44,13 @@ message("bin_len='${bin_len}'")
message("substr_len='${substr_len}'")
message("bin_dir='${bin_dir}'")
message("in_source_build='${in_source_build}'")
+message("build_under_source='${build_under_source}'")
message("")
+if(build_under_source)
+ message(STATUS "Skipping rest of test because build tree is under source tree")
+ return()
+endif()
# If this does not appear to be a git checkout, just pass the test here
# and now. (Do not let the test fail if it is run in a tree *exported* from a