From 1cf43dcf7c63a61e6254d102314b121623d2086d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Apr 2015 10:38:17 -0400 Subject: Tests: Add case to cover ExternalProject with subdirectories Add an ExternalProjectSubdir test directory with a minimal test showing use of ExternalProject_Add for a source tree in a subdirectory. This will allow us to easily add test external projects that cover specific behavior where the client project must check results. --- Tests/CMakeLists.txt | 12 ++++++++++++ Tests/ExternalProjectSubdir/CMakeLists.txt | 14 ++++++++++++++ Tests/ExternalProjectSubdir/Subdir1/CMakeLists.txt | 6 ++++++ 3 files changed, 32 insertions(+) create mode 100644 Tests/ExternalProjectSubdir/CMakeLists.txt create mode 100644 Tests/ExternalProjectSubdir/Subdir1/CMakeLists.txt diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 699b616..6abee25 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1326,6 +1326,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release set_tests_properties(ExternalProject PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) + add_test(NAME ExternalProjectSubdir + COMMAND ${CMAKE_CTEST_COMMAND} -C $ + --build-and-test + "${CMake_SOURCE_DIR}/Tests/ExternalProjectSubdir" + "${CMake_BINARY_DIR}/Tests/ExternalProjectSubdir" + ${build_generator_args} + --build-project ExternalProjectSubdir + --force-new-ctest-process + --build-options ${build_options} + ) + list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectSubdir") + add_test(ExternalProjectLocal ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalProjectLocal" diff --git a/Tests/ExternalProjectSubdir/CMakeLists.txt b/Tests/ExternalProjectSubdir/CMakeLists.txt new file mode 100644 index 0000000..fb5aa3c --- /dev/null +++ b/Tests/ExternalProjectSubdir/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.2) +project(ExternalProjectSubdir NONE) +include(ExternalProject) + +ExternalProject_Add(Subdir1 + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Subdir1 + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Subdir1 + + CMAKE_ARGS -DNORMAL_VAR=NORMAL_VALUE + LOG_CONFIGURE 1 + + BUILD_COMMAND "" + INSTALL_COMMAND "" + ) diff --git a/Tests/ExternalProjectSubdir/Subdir1/CMakeLists.txt b/Tests/ExternalProjectSubdir/Subdir1/CMakeLists.txt new file mode 100644 index 0000000..8b0653a --- /dev/null +++ b/Tests/ExternalProjectSubdir/Subdir1/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.2) +project(Subdir1 NONE) + +if(NOT "${NORMAL_VAR}" STREQUAL "NORMAL_VALUE") + message(SEND_ERROR "NORMAL_VAR != 'NORMAL_VALUE'") +endif() -- cgit v0.12