Skip to content
Snippets Groups Projects
Commit 3d6dc19c authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Merge branch 'bugfix/complex-CMAKE_GUARD-expressions' into 'master'

add_dune_test: Handle complex expressions in `CMAKE_GUARD`

The check `if(NOT ${condition})` does not behave as expected when
`condition` is a complex string expression such as `A OR B`. It does
however work when `condition` is a list.

Therefore convert `condition` to a list by calling `separate_arguments`.

Note that this change also adds missing parenthesis around `condition`
which also results in wrong results for complex expressions.

Closes issue #39.

See merge request !117
parents af332cef 074f0993
Branches
Tags
1 merge request!117add_dune_test: Handle complex expressions in `CMAKE_GUARD`
Pipeline #
......@@ -100,6 +100,9 @@
# as skipped in the test summary. Use this feature instead of guarding
# the call to :code:`dune_add_test` with an :code:`if` clause.
#
# The passed condition can be a complex expression like
# `( A OR B ) AND ( C OR D )`. Mind the spaces around the parantheses.
#
# .. cmake_param:: COMMAND
# :multi:
# :argname: cmd
......@@ -228,7 +231,8 @@ function(dune_add_test)
set(DOSOMETHING TRUE)
set(FAILED_CONDITION_PRINTING "")
foreach(condition ${ADDTEST_CMAKE_GUARD})
if(NOT ${condition})
separate_arguments(condition)
if(NOT (${condition}))
set(DOSOMETHING FALSE)
set(FAILED_CONDITION_PRINTING "${FAILED_CONDITION_PRINTING}std::cout << \" ${condition}\" << std::endl;\n")
endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment