summaryrefslogtreecommitdiffstats
path: root/Tests/Contracts
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-26 19:43:29 (GMT)
committerBrad King <brad.king@kitware.com>2017-11-03 15:35:06 (GMT)
commit4bd5af6302f0b7bafecf9ca7919287fe4d3f09e0 (patch)
treefd84d176d6eb2d9fa5f516c0cc004a40b58b4452 /Tests/Contracts
parent0ce082b7c823c0f88fbb329ca05d69a8f60f3851 (diff)
downloadCMake-4bd5af6302f0b7bafecf9ca7919287fe4d3f09e0.zip
CMake-4bd5af6302f0b7bafecf9ca7919287fe4d3f09e0.tar.gz
CMake-4bd5af6302f0b7bafecf9ca7919287fe4d3f09e0.tar.bz2
Tests: Factor out contract test HOME finding
Diffstat (limited to 'Tests/Contracts')
-rw-r--r--Tests/Contracts/Home.cmake19
-rw-r--r--Tests/Contracts/Trilinos/CMakeLists.txt19
-rw-r--r--Tests/Contracts/VTK/CMakeLists.txt19
3 files changed, 21 insertions, 36 deletions
diff --git a/Tests/Contracts/Home.cmake b/Tests/Contracts/Home.cmake
new file mode 100644
index 0000000..8b05e81
--- /dev/null
+++ b/Tests/Contracts/Home.cmake
@@ -0,0 +1,19 @@
+# Find a home in which to build.
+if(NOT DEFINED HOME)
+ if(DEFINED ENV{CTEST_REAL_HOME})
+ set(HOME "$ENV{CTEST_REAL_HOME}")
+ else()
+ set(HOME "$ENV{HOME}")
+ endif()
+
+ if(NOT HOME AND WIN32)
+ # Try for USERPROFILE as HOME equivalent:
+ string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}")
+
+ # But just use root of SystemDrive if USERPROFILE contains any spaces:
+ # (Default on XP and earlier...)
+ if(HOME MATCHES " ")
+ string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}")
+ endif()
+ endif()
+endif()
diff --git a/Tests/Contracts/Trilinos/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt
index 8d74ca5..4d7062b 100644
--- a/Tests/Contracts/Trilinos/CMakeLists.txt
+++ b/Tests/Contracts/Trilinos/CMakeLists.txt
@@ -6,24 +6,7 @@ include(ExternalProject)
include("${CMAKE_CURRENT_SOURCE_DIR}/LocalOverrides.cmake" OPTIONAL)
include("${CMAKE_CURRENT_BINARY_DIR}/LocalOverrides.cmake" OPTIONAL)
-if(NOT DEFINED HOME)
- if(DEFINED ENV{CTEST_REAL_HOME})
- set(HOME "$ENV{CTEST_REAL_HOME}")
- else()
- set(HOME "$ENV{HOME}")
- endif()
-
- if(NOT HOME AND WIN32)
- # Try for USERPROFILE as HOME equivalent:
- string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}")
-
- # But just use root of SystemDrive if USERPROFILE contains any spaces:
- # (Default on XP and earlier...)
- if(HOME MATCHES " ")
- string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}")
- endif()
- endif()
-endif()
+include(${CMAKE_CURRENT_SOURCE_DIR}/../Home.cmake)
message(STATUS "HOME='${HOME}'")
if(NOT DEFINED url)
diff --git a/Tests/Contracts/VTK/CMakeLists.txt b/Tests/Contracts/VTK/CMakeLists.txt
index ef19325..c946499 100644
--- a/Tests/Contracts/VTK/CMakeLists.txt
+++ b/Tests/Contracts/VTK/CMakeLists.txt
@@ -5,24 +5,7 @@ project(VTK)
include(ExternalProject)
# find "HOME". VTK will be downloaded & built within a subdirectory.
-if(NOT DEFINED HOME)
- if(DEFINED ENV{CTEST_REAL_HOME})
- set(HOME "$ENV{CTEST_REAL_HOME}")
- else()
- set(HOME "$ENV{HOME}")
- endif()
-
- if(NOT HOME AND WIN32)
- # Try for USERPROFILE as HOME equivalent:
- string(REPLACE "\\" "/" HOME "$ENV{USERPROFILE}")
-
- # But just use root of SystemDrive if USERPROFILE contains any spaces:
- # (Default on XP and earlier...)
- if(HOME MATCHES " ")
- string(REPLACE "\\" "/" HOME "$ENV{SystemDrive}")
- endif()
- endif()
-endif()
+include(${CMAKE_CURRENT_SOURCE_DIR}/../Home.cmake)
set(base_dir "${HOME}/.cmake/Contracts/VTK")