From 1065ca3589bcb8aa93508be68c261a40377dc0b5 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 27 Aug 2013 22:26:21 +0200 Subject: [PATCH 1/3] Noarch lib-dir was only used in one wrong place dune.module does not contain any paths to architecture-specific binaries. It is therefore always installed in no-arch lib/ directory. Thus, there is no need to have a variable for this, and there was no other users of this variable either. --- cmake/Modules/OpmInstall.cmake | 2 +- cmake/Modules/UseMultiArch.cmake | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/cmake/Modules/OpmInstall.cmake b/cmake/Modules/OpmInstall.cmake index 1c713717..59435249 100644 --- a/cmake/Modules/OpmInstall.cmake +++ b/cmake/Modules/OpmInstall.cmake @@ -50,6 +50,6 @@ macro (opm_install opm) endif (${opm}_LIBRARY_TYPE STREQUAL "SHARED" AND ${opm}_TARGET AND ${opm}_DEBUG) install ( FILES ${PROJECT_SOURCE_DIR}/dune.module - DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}${${opm}_VER_DIR}/dunecontrol/${${opm}_NAME} + DESTINATION lib${${opm}_VER_DIR}/dunecontrol/${${opm}_NAME} ) endmacro (opm_install opm) diff --git a/cmake/Modules/UseMultiArch.cmake b/cmake/Modules/UseMultiArch.cmake index 06a40126..f1a5d665 100644 --- a/cmake/Modules/UseMultiArch.cmake +++ b/cmake/Modules/UseMultiArch.cmake @@ -5,10 +5,6 @@ # depending on the platform; use this path # for platform-specific binaries. # -# CMAKE_INSTALL_LIBDIR_NOARCH to lib or lib64 depending on the platform; -# use this path for architecture-independent -# files. -# # Note that it will override the results of GNUInstallDirs if included after # that module. @@ -22,21 +18,15 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") else (EXISTS "/etc/debian_version") # 64-bit system? if (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (_libdir_noarch "lib64") + set (_libdir_def "lib64") else (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (_libdir_noarch "lib") + set (_libdir_def "lib") endif (CMAKE_SIZEOF_VOID_P EQUAL 8) - set (_libdir_def "${_libdir_noarch}") endif (EXISTS "/etc/debian_version") else ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") set (_libdir_def "lib") - set (_libdir_noarch "lib") endif ("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") # let the user override if somewhere else is desirable set (CMAKE_INSTALL_LIBDIR "${_libdir_def}" CACHE PATH "Object code libraries") -set (CMAKE_INSTALL_LIBDIR_NOARCH "${_libdir_noarch}" CACHE PATH "Architecture-independent library files") -mark_as_advanced ( - CMAKE_INSTALL_LIBDIR - CMAKE_INSTALL_LIBDIR_NOARCH - ) +mark_as_advanced (CMAKE_INSTALL_LIBDIR) From 47b2c64675cd9c2dc0e8105161659991b7c2bfac Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Tue, 27 Aug 2013 22:28:53 +0200 Subject: [PATCH 2/3] Always search for dune.module in no-arch lib-dir The previous version may have ended up in lib64/ instead of lib/; now we remove the arch-specific suffix from the path, and always use the no-arch version. --- cmake/Modules/UseDuneVer.cmake | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/UseDuneVer.cmake b/cmake/Modules/UseDuneVer.cmake index ef917d08..199ac6ea 100644 --- a/cmake/Modules/UseDuneVer.cmake +++ b/cmake/Modules/UseDuneVer.cmake @@ -62,7 +62,17 @@ function (find_dune_version suite module) # remove multi-arch part of the library path to get parent get_filename_component (_lib_path "${_lib_path}" PATH) endif () - set (_dune_mod "${_lib_path}${_multilib}/dunecontrol/${suite}-${module}/dune.module") + get_filename_component (_immediate "${_lib_path}" NAME) + if (("${_immediate}" STREQUAL "${CMAKE_INSTALL_LIBDIR}") + OR ("${_immediate}" STREQUAL "lib")) + # remove library part of the path; this also undo the suffix + # we added if we used the library as a standin + get_filename_component (_lib_path "${_lib_path}" PATH) + endif () + # 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}/lib${_multilib}/dunecontrol/${suite}-${module}/dune.module") if (NOT EXISTS "${_dune_mod}") # use the name itself as a flag for whether it was found or not set (_dune_mod "") @@ -71,8 +81,14 @@ function (find_dune_version suite module) # if it is not available, it may make havoc having empty defines in the source # code later, so we bail out early - if (${suite}-${module}_FIND_REQUIRED AND NOT _dune_mod) - message (FATAL_ERROR "Failed to locate dune.module for ${suite}-${module}") + if (_dune_mod) + message (STATUS "Version of ${suite}-${module} from ${_dune_mod}") + else () + if (${suite}-${module}_FIND_REQUIRED) + message (FATAL_ERROR "Failed to locate dune.module for ${suite}-${module}") + else () + return () + endif () endif () # parse the file for the Version: field From 976c5c54a29f57fbd2228e202feada046c24b998 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Wed, 28 Aug 2013 09:47:52 +0200 Subject: [PATCH 3/3] Print version number in log together with location --- cmake/Modules/UseDuneVer.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmake/Modules/UseDuneVer.cmake b/cmake/Modules/UseDuneVer.cmake index 199ac6ea..116de6ce 100644 --- a/cmake/Modules/UseDuneVer.cmake +++ b/cmake/Modules/UseDuneVer.cmake @@ -81,9 +81,7 @@ function (find_dune_version suite module) # if it is not available, it may make havoc having empty defines in the source # code later, so we bail out early - if (_dune_mod) - message (STATUS "Version of ${suite}-${module} from ${_dune_mod}") - else () + if (NOT _dune_mod) if (${suite}-${module}_FIND_REQUIRED) message (FATAL_ERROR "Failed to locate dune.module for ${suite}-${module}") else () @@ -117,4 +115,7 @@ function (find_dune_version suite module) set (${_SUITE}_${_MODULE}_VERSION_MINOR "${_minor}" PARENT_SCOPE) set (${_SUITE}_${_MODULE}_VERSION_REVISION "${_revision}" PARENT_SCOPE) endif () + + # print the version number we detected in the configuration log + message (STATUS "Version ${_major}.${_minor}.${_revision} of ${suite}-${module} from ${_dune_mod}") endfunction (find_dune_version suite module)