Skip to content
Snippets Groups Projects
Commit 80023ad9 authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

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.
parent af332cef
Branches
Tags
1 merge request!117add_dune_test: Handle complex expressions in `CMAKE_GUARD`
Pipeline #
......@@ -228,7 +228,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