From ebca3539a3563c15f99c5e6a236d6bcc05d29796 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.r.kempf@gmail.com> Date: Mon, 13 Jul 2015 14:11:41 +0200 Subject: [PATCH] [cmake][Release] Allow downstream modules to disable the testing magic Some downstream modules like pdelab and dumux already abandoned the current bahaviour of building tests on make test. The testing infrastructure does throw them error messages during make test though. This commi introduces the switch DUNE_DISABLE_TEST_MAGIC which may be set by downstream modules to disable the magic. To see how to switch a downstream module, see: http://conan2.iwr.uni-heidelberg.de/git/pdelab/dune-pdelab/commit/dc5ef4b39f5be5690457f0bbfe008b1f45d5fd98 --- cmake/modules/DuneMacros.cmake | 4 +++- cmake/modules/DuneTestMacros.cmake | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake index b5d8752ae..9d9221c84 100644 --- a/cmake/modules/DuneMacros.cmake +++ b/cmake/modules/DuneMacros.cmake @@ -882,7 +882,9 @@ endif() configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) endif("${ARGC}" EQUAL "1") - test_dep() + if(NOT DUNE_DISABLE_TEST_MAGIC) + test_dep() + endif() include(CPack) diff --git a/cmake/modules/DuneTestMacros.cmake b/cmake/modules/DuneTestMacros.cmake index 3b5331718..7cea1645c 100644 --- a/cmake/modules/DuneTestMacros.cmake +++ b/cmake/modules/DuneTestMacros.cmake @@ -47,8 +47,10 @@ endmacro(get_directory_test_target _target _dir) # E.g. for dune/istl/test the target will be dune_istl_test. # macro(add_directory_test_target _target) - get_directory_test_target(${_target} "${CMAKE_CURRENT_BINARY_DIR}") - add_custom_target(${${_target}}) - dune_common_script_dir(SCRIPT_DIR) - configure_file(${SCRIPT_DIR}/BuildTests.cmake.in BuildTests.cmake @ONLY) + if(NOT DUNE_DISABLE_TEST_MAGIC) + get_directory_test_target(${_target} "${CMAKE_CURRENT_BINARY_DIR}") + add_custom_target(${${_target}}) + dune_common_script_dir(SCRIPT_DIR) + configure_file(${SCRIPT_DIR}/BuildTests.cmake.in BuildTests.cmake @ONLY) + endif() endmacro(add_directory_test_target) -- GitLab