[CMake] Cleanup code which adds flags for external grids.

Move code from both if branches out of the if.
UseUG and AddALUGridFlags become more similar.
Fix indentig, make line breaks more consistent.

Conflicts:
	cmake/modules/UseUG.cmake
[CMake] Fix CMke warnings CMP0022 and CMP0038 for ALUGrid and UG.

Prevent dunegrid to link to itself. This happend when the flags for
ALUGrid or UG where added. This caused CMP0038 that will become an
error with CMake 3.0.0.
This fixed the annoying CMP0022 warnings about the link targets
interface, too.
For Alberta both issues remain yet un-fixed.

(cherry picked from commit ea943ab030adcbe72067037aef41944ccc5141a2)
Signed-off-by: Christoph Grüninger <gruenich@dune-project.org>
[CMake] Improve generation of libdunegrid with Alberta.

Fix OBJECT stuff in AddAlbertaFlags.
Fix warnings CMP0038 for Alberta caused by linking libdunegrid to itself.

(cherry picked from commit 759f9f0d52813b1de85f1147565ff26ba1db9aac)
Signed-off-by: Christoph Grüninger <gruenich@dune-project.org>
[CMake] Merge remaining changes by previously incomplete merges.
[CMake][grape] Fix wrong compile flag.

"-D" is already added by CMake.

(cherry picked from commit cc7fc99fc4b3ac72bd4b933e8f8d86ffde11867f)
Signed-off-by: Christoph Grüninger <gruenich@dune-project.org>
[CMake] Repair shared libraries for CMake < 3.0.

a) OBJECT is needed to avoid linking libdunegrid to itself.
b) Linking a library to itself will become an error in CMake 3.0.
c) Shared libraries build with OBJECT will fail for user code
   that links DUNE_LIBS but sets not the flags for the linked
   grids (e.g. in dune-localfunctions 2.3 or dune-pdelab).
   The order of libs is not correct, libdunegrid should be
   before the external grids.
d) Staying compatible with CMake 2.8.6 forces us to not
   use the linking stuff introduced by 2.8.9 and 2.8.12.
e) Maybe we can fix this in Dune's code, but not as fast
   as needed.
Due to a) - e) you cannot build shared libraries with external
grids and CMake 3.0.
Static libs do work.

(cherry picked from commit a21f4572e1e9b4cdf09a57e73c80a7895a839340)
Signed-off-by: Christoph Grüninger <gruenich@dune-project.org>