THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#263 - Don't build executables on make test
User who did this - Christoph GrĂ¼ninger (gruenich)

----------
Advantages:
- we get rid of the DUMUX_BUILD_ALL_TESTS workaround
- no hidden magic, more CMake style, everthing is stated in the CMakeLists.txt
- not needed to build all tests if only one test should be checked
Disadvantages:
- CTest fails when test are not built
- "make all" is disabled in the dumux directory, it only works in dumux/test, 
dumux/tutorial etc.

I created the following patch, please give it a try:

Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt      (revision 14609)
+++ CMakeLists.txt      (working copy)
@@ -22,12 +22,10 @@
 # start a dune project with information from dune.module
 dune_project()
 
-#add_subdirectory("m4")
-#add_subdirectory("dumux")
-add_subdirectory("doc")
-add_subdirectory("cmake/modules")
-add_subdirectory("test")
-add_subdirectory("tutorial")
+add_subdirectory(cmake/modules)
+add_subdirectory(doc)
+add_subdirectory(test EXCLUDE_FROM_ALL)
+add_subdirectory(tutorial EXCLUDE_FROM_ALL)
 
 # finalize the dune project, e.g. generating config.h etc.
 finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
Index: cmake/modules/DumuxTestMacros.cmake
===================================================================
--- cmake/modules/DumuxTestMacros.cmake (revision 14609)
+++ cmake/modules/DumuxTestMacros.cmake (working copy)
@@ -13,20 +13,12 @@
 # - further arguments:            are optional and are used as arguments for 
calling the test
 ###
 macro(add_dumux_test dumux_test dumux_test_executable 
dumux_test_executable_source)
-  # create test target for directory, but only if not yet created
-  get_directory_test_target(potential_test_target 
"${CMAKE_CURRENT_BINARY_DIR}")
-  if(NOT TARGET ${potential_test_target})
-    add_directory_test_target(_test_target)
-    set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-      PROPERTY TEST_INCLUDE_FILE ${CMAKE_CURRENT_BINARY_DIR}/BuildTests.cmake)
+  # if present, copy grids folder
+  set(grids_directory ${CMAKE_CURRENT_SOURCE_DIR}/grids)
+  if(EXISTS ${grids_directory} AND IS_DIRECTORY ${grids_directory})
+    file(COPY ${grids_directory} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+  endif()
 
-    # if present, copy grids folder
-    set(grids_directory ${CMAKE_CURRENT_SOURCE_DIR}/grids)
-    if(EXISTS ${grids_directory} AND IS_DIRECTORY ${grids_directory})
-      file(COPY ${grids_directory} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-    endif()
-  endif(NOT TARGET ${potential_test_target})
-
   # if present, copy input file
   set(input_file ${CMAKE_CURRENT_SOURCE_DIR}/${dumux_test_executable}.input)
   if(NOT EXISTS ${input_file})
@@ -40,12 +32,7 @@
   # add executable
   # check whether executable already exists
   if(NOT TARGET ${dumux_test_executable})
-    #set property whether it has to be built with make or only with make test
-    if(${DUMUX_BUILD_ALL_TESTS})
-      add_executable(${dumux_test_executable} ${dumux_test_executable_source})
-    else()
-      add_executable(${dumux_test_executable} EXCLUDE_FROM_ALL 
${dumux_test_executable_source})
-    endif(${DUMUX_BUILD_ALL_TESTS})
+    add_executable(${dumux_test_executable} ${dumux_test_executable_source})
   endif(NOT TARGET ${dumux_test_executable})
 
   # link all libraries to executable, add all flags
@@ -58,7 +45,6 @@
 
   # add test
   add_test(${dumux_test} ${dumux_test_args})
-  add_dependencies(${_test_target} ${dumux_test_executable})
 
   # return code 77 should be interpreted as skipped test
   set_tests_properties(${dumux_test} PROPERTIES SKIP_RETURN_CODE 77)
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt (revision 14609)
+++ test/CMakeLists.txt (working copy)
@@ -6,5 +6,3 @@
 add_subdirectory("io")
 add_subdirectory("material")
 add_subdirectory("multidomain")
-
-add_directory_test_target(_test_target)

----------

More information can be found at the following URL:
http://www.dumux.org/flyspray/index.php?do=details&task_id=263#comment560

You are receiving this message because you have requested it from the Flyspray 
bugtracking system.  If you did not expect this message or don't want to 
receive mails in future, you can change your notification settings at the URL 
shown above.
_______________________________________________
Dumux mailing list
Dumux@listserv.uni-stuttgart.de
https://listserv.uni-stuttgart.de/mailman/listinfo/dumux

Reply via email to