Description: Install cmake config of header-only module in /usr/lib/cmake
 Needed to make it work in multiarch settings.
Author: Markus Blatt
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/cmake/modules/DuneAddLibrary.cmake
+++ b/cmake/modules/DuneAddLibrary.cmake
@@ -135,7 +135,6 @@ Add a library to a Dune module.
 #]=======================================================================]
 include_guard(GLOBAL)
 
-
 # Public interface for creating a module library
 function(dune_add_library _name)
   cmake_parse_arguments(ARG "OBJECT;INTERFACE" "" "" ${ARGN})
@@ -213,6 +212,8 @@ function(dune_add_library_normal _name)
       set(ARG_NAMESPACE Dune::)
     endif()
 
+    set_property(GLOBAL PROPERTY ${PROJECT_NAME}_HAS_LIB ON)
+
     set(alias ${ARG_NAMESPACE}${ARG_EXPORT_NAME})
     if(NOT TARGET ${alias})
       add_library(${alias} ALIAS ${_name})
--- a/cmake/modules/DuneProject.cmake
+++ b/cmake/modules/DuneProject.cmake
@@ -425,7 +425,15 @@ endif()")
   if(DEFINED DUNE_INSTALL_LIBDIR)
     message(DEPRECATION "DUNE_INSTALL_LIBDIR is deprecated, use CMAKE_INSTALL_LIBDIR instead")
   else()
-    set(DUNE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
+    # Determine whether this module is header-only
+    # In the case the property is not defined
+    get_property(_has_lib GLOBAL PROPERTY ${PROJECT_NAME}_HAS_LIB SET)
+
+    if(_has_lib)
+      set(DUNE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
+    else()
+      set(DUNE_INSTALL_LIBDIR ${DUNE_INSTALL_NONOBJECTLIBDIR})
+    endif()
   endif()
 
   # Set the location of the doc file source. Needed by custom package configuration
@@ -538,7 +546,7 @@ get_filename_component(_dir \"\${CMAKE_C
 
     # install library export set
     install(EXPORT ${_export_set}
-      DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${ProjectName}
+      DESTINATION ${DUNE_INSTALL_LIBDIR}/cmake/${ProjectName}
       NAMESPACE ${_namespace}
       FILE ${_target_file})
 
