]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Bugfix: Force cache update for DEAL_II_(C|CXX)_FLAGS 2793/head
authorMatthias Maier <tamiko@43-1.org>
Sat, 9 Jul 2016 09:26:25 +0000 (04:26 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sat, 9 Jul 2016 09:45:33 +0000 (04:45 -0500)
This fixes a subtle bug:

 - We use DEAL_II_(C|CXX)_FLAGS, DEAL_II_LINKER_FLAGS internally and we
   allow users to set additional compiler/linker flags via cached variants
   of these variables (because users tend to assume every variable starts
   with DEAL_II_*).

 - But, we also allow to set CMAKE_(C|CXX)_FLAGS, etc. (not supporting this
   would be crazy).

 - Last, but not least, the environment variables CFLAGS, CXXFLAGS, LDFLAGS
   are also supported.

We support this by prepending all DEAL_II_* variables with their CMAKE_*
and environment counterparts. But for this to work we also have to force
update the cache. With this change

  CXXFLAGS="-foo" cmake -DCMAKE_CXX_FLAGS="-bar" -DDEAL_II_CXX_FLAGS="-baz" .

results in

  DEAL_II_FLAGS="[.. internal flag setup ..] -foo -bar -baz"

as intended. Reconfiguring with

  CXXFLAGS="-foo" cmake .

retains DEAL_II_FLAGS.

cmake/setup_cached_variables.cmake

index 29ff273731247e23c601e7db0cb91a25ba5cbf97..f9211584a6d89da4f3337601e400555e11487d2a 100644 (file)
@@ -265,6 +265,7 @@ FOREACH(_flag ${DEAL_II_USED_FLAGS})
   #
   SET(${_flag} "${${_flag}}" CACHE STRING
     "The user supplied cache variable will be appended _at the end_ of the configuration step to the auto generated ${_flag} variable"
+    FORCE
     )
   MARK_AS_ADVANCED(${_flag})
 

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.