From 4f7316eb52a272c29e1c52e34a787821c3f6b66b Mon Sep 17 00:00:00 2001 From: Christoph Grueninger <christoph.grueninger@iws.uni-stuttgart.de> Date: Tue, 25 Nov 2014 11:31:30 +0000 Subject: [PATCH] [CMake] Add function add_dumux_all_flags. The function can be used instead of calling the add_dune_*_flag functions. The function is called from add_dumux_test. (reviewed by bernd) git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13785 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- cmake/modules/DumuxTestMacros.cmake | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/cmake/modules/DumuxTestMacros.cmake b/cmake/modules/DumuxTestMacros.cmake index d36afc4f26..4e9a81dfe4 100644 --- a/cmake/modules/DumuxTestMacros.cmake +++ b/cmake/modules/DumuxTestMacros.cmake @@ -48,8 +48,8 @@ macro(add_dumux_test dumux_test dumux_test_executable dumux_test_executable_sour endif(${DUMUX_BUILD_ALL_TESTS}) endif(NOT TARGET ${dumux_test_executable}) - # link all libraries to executable - target_link_libraries(${dumux_test_executable} ${DUNE_LIBS}) + # link all libraries to executable, add all flags + add_dumux_all_flags(${dumux_test_executable}) # get optional arguments # cannot use ARGN directly with list() command, copy to a variable first @@ -59,4 +59,23 @@ macro(add_dumux_test dumux_test dumux_test_executable dumux_test_executable_sour # add test add_test(${dumux_test} ${dumux_test_args}) add_dependencies(${_test_target} ${dumux_test_executable}) -endmacro(add_dumux_test) +endmacro() + +### +# adds flags for all third party libraries used in DuMuX to the given targets +### +function(add_dumux_all_flags) + cmake_parse_arguments(ADD_DUMUX_ALL_FLAGS "" "" "" ${ARGN}) + foreach(_target ${ADD_DUMUX_ALL_FLAGS_UNPARSED_ARGUMENTS}) + # add flags + add_dune_mpi_flags(${_target}) + add_dune_alberta_flags(${_target}) + add_dune_alugrid_flags(${_target}) + add_dune_ug_flags(${_target}) + add_dune_umfpack_flags(${_target}) + add_dune_superlu_flags(${_target}) + # add Dune libraries + target_link_libraries(${_target} ${DUNE_LIBS}) + target_link_libraries(${_target} ${ZLIB_LIBRARIES}) + endforeach() +endfunction() -- GitLab