diff options
author | David Cole <david.cole@kitware.com> | 2012-01-17 21:25:01 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2012-01-17 21:25:01 (GMT) |
commit | 4cfaa91ef0ca4a85a7c39e4a9ef07eb299d5a7bf (patch) | |
tree | ebde283d753fb44787270cf7986b233ac5eef542 | |
parent | 1120bb699089b0156ca0862a967a33e9d2426426 (diff) | |
parent | 9a20abf04a7fc11b53beb545f1555fe9815ae09c (diff) | |
download | CMake-4cfaa91ef0ca4a85a7c39e4a9ef07eb299d5a7bf.zip CMake-4cfaa91ef0ca4a85a7c39e4a9ef07eb299d5a7bf.tar.gz CMake-4cfaa91ef0ca4a85a7c39e4a9ef07eb299d5a7bf.tar.bz2 |
Merge topic 'add_CMakeOnly_test-infrastructure'
9a20abf Add infrastructure for CMake-only tests
-rw-r--r-- | Tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CMakeOnly/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/CMakeOnly/Test.cmake.in | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 00c9ac7..badc76b 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -47,6 +47,7 @@ IF(BUILD_TESTING) ENDIF() ADD_SUBDIRECTORY(CMakeLib) + ADD_SUBDIRECTORY(CMakeOnly) ADD_SUBDIRECTORY(FindPackageModeMakefileTest) diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt new file mode 100644 index 0000000..d32e7be --- /dev/null +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -0,0 +1,9 @@ +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Test.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake @ONLY) + +macro(add_CMakeOnly_test test) + add_test(CMakeOnly.${test} ${CMAKE_CMAKE_COMMAND} + -DTEST=${test} + -P ${CMAKE_CURRENT_BINARY_DIR}/Test.cmake + ) +endmacro() diff --git a/Tests/CMakeOnly/Test.cmake.in b/Tests/CMakeOnly/Test.cmake.in new file mode 100644 index 0000000..aa2d093 --- /dev/null +++ b/Tests/CMakeOnly/Test.cmake.in @@ -0,0 +1,12 @@ +set(source_dir "@CMAKE_CURRENT_SOURCE_DIR@/${TEST}") +set(binary_dir "@CMAKE_CURRENT_BINARY_DIR@/${TEST}-build") +file(REMOVE_RECURSE "${binary_dir}") +file(MAKE_DIRECTORY "${binary_dir}") +execute_process( + COMMAND ${CMAKE_COMMAND} "${source_dir}" -G "@CMAKE_TEST_GENERATOR@" + WORKING_DIRECTORY "${binary_dir}" + RESULT_VARIABLE result + ) +if(result) + message(FATAL_ERROR "CMake failed to configure ${TEST}") +endif() |