]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Simplify the example CMake compilation script. 12220/head
authorDavid Wells <drwells@email.unc.edu>
Sun, 16 May 2021 19:00:56 +0000 (15:00 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sun, 16 May 2021 19:00:56 +0000 (15:00 -0400)
examples/CMakeLists.txt

index 824abea40d5ee24aabd77c21b3f0491eb9aa6607..669fb2cd0357717d393a591f11ccb5fec9d33422 100644 (file)
@@ -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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.