From ea838342aa3d457f9180b2bc31f107d36671ac05 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 16 May 2021 15:00:56 -0400 Subject: [PATCH] Simplify the example CMake compilation script. --- examples/CMakeLists.txt | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 824abea40d..669fb2cd03 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -66,7 +66,7 @@ IF(DEAL_II_COMPONENT_EXAMPLES) # # Extract dependency information from CMakeLists.txt file. # - SET(_dependency_string TRUE) + SET(_setup FALSE) IF(EXISTS "${_directory}/CMakeLists.txt") FILE(STRINGS "${_directory}/CMakeLists.txt" _dependency_string REGEX "^IF.*DEAL_II.* # keep in one line$" @@ -74,23 +74,18 @@ IF(DEAL_II_COMPONENT_EXAMPLES) STRING(REPLACE "IF(" "" _dependency_string "${_dependency_string}") STRING(REPLACE ") # keep in one line" "" _dependency_string "${_dependency_string}") IF("${_dependency_string}" STREQUAL "") - SET(_dependency_string "TRUE") + SET(_setup TRUE) ELSE() - SET(_dependency_string "NOT (${_dependency_string})") + # if the dependency string evaluates to TRUE then the example + # CMakeLists.txt encounters a fatal error - we want the opposite logic + # here so add a NOT. + EVALUATE_EXPRESSION(" + IF(NOT (${_dependency_string})) + SET(_setup TRUE) + ENDIF()") ENDIF() ENDIF() - # - # Now evaluate the _dependency_string and store the result in _setup. - # We have to be careful - ${_dependency_string} evaluating to true - # means that not all dependencies are fulfilled. - # - SET(_setup FALSE) - EVALUATE_EXPRESSION(" - IF(${_dependency_string}) - SET(_setup TRUE) - ENDIF()") - IF(_setup) FOREACH(_build ${DEAL_II_BUILD_TYPES}) STRING(TOLOWER ${_build} _build_lowercase) -- 2.39.5