[cmake] Fix INSTALL_INTERFACE properties set by dune_target_enable_all_packages

Problematic case already fixed with removal of dune-module include paths in !1457 (merged).

When switching from dune_enable_all_packages to dune_target_enable_all_packages for a module library, the target is installed with all the paths to source/build include directories. Using the imported target downstream leads to CMake errors on all using targets (after removing the source/build from which was installed).

CMake Error in exercises/solution/exercise-model/CMakeLists.txt:
  Imported target "Dumux::Dumux" includes non-existent path

    "/path/to/source/dune-istl"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

This MR limits the ALL_PKG_INCS to the BUILD_INTERFACE of the target's INTERFACE_INCLUDE_DIRECTORIES, adding instead CMAKE_INSTALL_INCLUDEDIR to the INSTALL_INTERFACE.

Edited by Mathis Kelm

Merge request reports

Loading