From: maier Date: Sat, 26 Oct 2013 12:36:37 +0000 (+0000) Subject: Bugfix: Regenerate testsuite subprojects if the main project configuration has changed X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a5a7ea2a9bfc3af3022b795b8f33b8e9179aea2;p=dealii-svn.git Bugfix: Regenerate testsuite subprojects if the main project configuration has changed git-svn-id: https://svn.dealii.org/trunk@31439 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/setup_testsuite.cmake b/deal.II/cmake/setup_testsuite.cmake index 63fd7e0c93..3d6eaf89be 100644 --- a/deal.II/cmake/setup_testsuite.cmake +++ b/deal.II/cmake/setup_testsuite.cmake @@ -112,3 +112,9 @@ SET_IF_EMPTY(TEST_TIME_LIMIT 600) # And finally, enable testing: # ENABLE_TESTING() + +# +# A custom target that does absolutely nothing. It is used in the main +# project to trigger a "make rebuild_cache" if necessary. +# +ADD_CUSTOM_TARGET(regenerate) diff --git a/deal.II/tests/CMakeLists.txt b/deal.II/tests/CMakeLists.txt index d9baf3976a..0e193ebf69 100644 --- a/deal.II/tests/CMakeLists.txt +++ b/deal.II/tests/CMakeLists.txt @@ -76,6 +76,9 @@ LIST(REMOVE_DUPLICATES _categories) # Define a subproject for every enabled category: # +MESSAGE(STATUS "") +MESSAGE(STATUS "Regenerating testsuite subprojects") + FOREACH(_category ${_categories}) IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_category}/CMakeLists.txt) SET(_category_dir ${CMAKE_CURRENT_SOURCE_DIR}/${_category}) @@ -98,12 +101,13 @@ FOREACH(_category ${_categories}) ) ADD_DEPENDENCIES(setup_tests setup_tests_${_category}) - # depend on a valid build directory (libraries built, config in place): + # depend on a valid build directory: ADD_DEPENDENCIES(setup_tests_${_category} setup_build_dir) ADD_CUSTOM_TARGET(clean_tests_${_category} COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/${_category} --target clean + > /dev/null # Shoo! ) ADD_DEPENDENCIES(clean_tests clean_tests_${_category}) @@ -117,5 +121,23 @@ FOREACH(_category ${_categories}) "SUBDIRS(${_category})\n" ) + # + # Regenerate subprojects: The "regenerate" target of the subproject + # depends on "rebuild_cache" so that the subprojects rerun cmake if + # necessary. + # (TODO: Unfortunately this is sequential - due to the fact that we + # cannot call back into the main build system) + # + + IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_category}/CMakeCache.txt) + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} + --build ${CMAKE_CURRENT_BINARY_DIR}/${_category} --target regenerate + OUTPUT_QUIET + ) + ENDIF() + ENDIF() ENDFOREACH() + +MESSAGE(STATUS "Regenerating testsuite subprojects - Done")