]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Bugfix: Regenerate testsuite subprojects if the main project configuration has changed
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 26 Oct 2013 12:36:37 +0000 (12:36 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 26 Oct 2013 12:36:37 +0000 (12:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@31439 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/setup_testsuite.cmake
deal.II/tests/CMakeLists.txt

index 63fd7e0c93eb91ac094024381f5727d2d2b98dfa..3d6eaf89be03f5e2fd6805d86ab6fdf797073498 100644 (file)
@@ -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)
index d9baf3976a682fc1e26407b112f31b8b81329173..0e193ebf69fc631ca93ef0508e55196cdbe08e5e 100644 (file)
@@ -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")

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.