[cmake] Modernize examples/CMakeLists.txt
Replace target_link_dune_default_libraries(target)
by the
modern dune_target_enable_all_packages(target)
. The problem
with the former is, that it does not append definitions, such
that we cannot use UGGrid
because ENABLE_UG
is not defined.
Surprisingly this is in contrast to dune_add_test(...)
which
does add the definitions.
Alternatively we could call dune_enable_all_packages()
in
our root CMakeLists.txt
, but I'm unsure about the implications.
Notice that this reveals several open questions regarding dune-common:
- Should
target_link_dune_default_libraries()
still be used or should it be deprecated in favour ofdune_target_enable_all_packages()
? - Should the
src/
example created byduneproject
still calltarget_link_dune_default_libraries()
altoughdune_enable_all_packages()
is called by default? - Should the call to
add_dune_all_flags()
indune_add_test()
be replaced bydune_target_enable_all_packages()
such that tests are build similarly to normal executables? - Should a library module (like, e.g. dune-functions) use
dune_enable_all_packages()
? Or is this discouraged, because it has to be used in all derived modules? - Do we allow building anything without using one of the add-all-flags approaches at all? In view of possible binary incompatibility it looks like "All tests use it" implies "All libraries have to use it" which implies "All applications have to use it"