From 9b2cf047e5b8a7443a3d52d6aed6137169068684 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Fri, 20 Sep 2013 13:17:38 +0200 Subject: [PATCH] Search for dune.module in private installations When doing a private install of DUNE libraries, the dune.module file is put in the lib/ directory, regardless of architecture. This patch searches the lib/ directory as a catch-all after having searched the platform-specific directories. This should minimize the chance of hitting an accidentally unrelated dune.module. --- cmake/Modules/UseDuneVer.cmake | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/UseDuneVer.cmake b/cmake/Modules/UseDuneVer.cmake index ac972be52..98e53994d 100644 --- a/cmake/Modules/UseDuneVer.cmake +++ b/cmake/Modules/UseDuneVer.cmake @@ -84,11 +84,22 @@ function (find_dune_version suite module) # from this point on, _lib_path does not contain an architecture- # specific component anymore; dune.module is always put in straight # noarch lib/ since it does not contain any paths to binaries - set (_dune_mod "${_lib_path}/${LIBDIR_MULTIARCH_UNAWARE}${_multilib}/dunecontrol/${suite}-${module}/dune.module") + set (_suffix "${_multilib}/dunecontrol/${suite}-${module}/dune.module") + set (_dune_mod "${_lib_path}/${LIBDIR_MULTIARCH_UNAWARE}${_suffix}") if (NOT EXISTS "${_dune_mod}") - # use the name itself as a flag for whether it was found or not set (_last_dune_mod_bld "${_dune_mod}") - set (_dune_mod "") + # one more try, if we have a private install, then it doesn't use + # e.g. lib64 but always lib (!) + if ("${LIBDIR_MULTIARCH_UNAWARE}" STREQUAL "lib") + set (_dune_mod "") + else () + set (_dune_mod "${_lib_path}/lib${_suffix}") + if (NOT EXISTS "${_dune_mod}") + set (_last_dune_mod_pri "${_dune_mod}") + # use the name itself as a flag for whether it was found or not + set (_dune_mod "") + endif () + endif () endif () endif () @@ -96,7 +107,14 @@ function (find_dune_version suite module) # code later, so we bail out early if (NOT _dune_mod) if (${suite}-${module}_FOUND) - message (FATAL_ERROR "Failed to locate dune.module for ${suite}-${module} (looking for either \"${_last_dune_mod_src}\" or \"${_last_dune_mod_bld}\")") + set (_searched_paths "\"${_last_dune_mod_src}\"") + if (NOT ("${_last_dune_mod_bld}" STREQUAL "")) + set (_searched_paths "either ${_searched_paths} or \"${_last_dune_mod_bld}\"") + endif () + if (NOT ("${_last_dune_mod_pri}" STREQUAL "")) + set (_searched_paths "${_searched_paths} or \"${_last_dune_mod_pri}\"") + endif () + message (FATAL_ERROR "Failed to locate dune.module for ${suite}-${module} (looking for ${_searched_paths})") else () return () endif ()