summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake
diff options
context:
space:
mode:
authorDaniele E. Domenichelli <daniele.domenichelli@iit.it>2014-10-28 10:05:57 (GMT)
committerBrad King <brad.king@kitware.com>2014-10-31 15:34:11 (GMT)
commit609037f4821c45ed13029074c8669d52c6dc9d71 (patch)
tree5b23fd95fd9cebdbe51d5cd9d9add686d0cddd58 /Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake
parent98cdb658e481a23c48ad894bec102ec5f060d72e (diff)
downloadCMake-609037f4821c45ed13029074c8669d52c6dc9d71.zip
CMake-609037f4821c45ed13029074c8669d52c6dc9d71.tar.gz
CMake-609037f4821c45ed13029074c8669d52c6dc9d71.tar.bz2
ExternalProject: Add unit tests for CMAKE_CACHE_DEFAULT_ARGS
Diffstat (limited to 'Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake')
-rw-r--r--Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake
new file mode 100644
index 0000000..c216664
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/CMAKE_CACHE_DEFAULT_ARGS.cmake
@@ -0,0 +1,21 @@
+include(ExternalProject)
+
+set(_tmp_dir "${CMAKE_CURRENT_BINARY_DIR}/tmp")
+set(_cache_file "${_tmp_dir}/FOO-cache.cmake")
+
+ExternalProject_Add(FOO TMP_DIR "${_tmp_dir}"
+ DOWNLOAD_COMMAND ""
+ CMAKE_CACHE_DEFAULT_ARGS "-DFOO:STRING=BAR")
+
+if(NOT EXISTS "${_cache_file}")
+ message(FATAL_ERROR "Initial cache not created")
+endif()
+
+file(READ "${_cache_file}" _cache)
+
+if(NOT "${_cache}" MATCHES "set\\(FOO \"BAR\".+\\)") # \(\)
+ message(FATAL_ERROR "Cannot find FOO argument in cache")
+endif()
+if("${CMAKE_MATCH_0}" MATCHES FORCE)
+ message(FATAL_ERROR "Expected not forced FOO argument")
+endif()