cmake: fix incorrect usage of CACHE variables
cmake: fix incorrect usage of CACHE variables

* setting CACHE variable recursively will keep adding parameters on cmake
  re-runs
* updating cached value of CMAKE_C_FLAGS and friends breaks the whole
  logic of it being passed on from a user initially and then necessary
  flags added on top, specifically it circumvents the
  `set(CMAKE_C_FLAGS_SAVE "${CMAKE_C_FLAGS}")`
  `do_stuff()`
  `set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_SAVE}")`
  trick utilized in several places (e.g. in darktable) when cmake is
  re-run
* that still leaves a general problem of updating global variables from
  inside the library, probably it should be done only at the top level
  of application cmake files, not ad-hoc like that, instead targets and
  other modern cmake features should be used

darktable-org/rawspeed,darktable-org/rawspeed,darktable-org/rawspeed,LebedevRI/rawspeed,LebedevRI/rawspeed,LebedevRI/rawspeed,darktable-org/rawspeed,darktable-org/rawspeed,LebedevRI/rawspeed,LebedevRI/rawspeed