Merge pull request #350 from rolk/350_dunemod

Dune.module is searched for in the wrong directory
This commit is contained in:
Bård Skaflestad 2013-08-28 03:53:08 -07:00
commit cf90e27830
3 changed files with 24 additions and 17 deletions

View File

@ -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)

View File

@ -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,12 @@ 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 (NOT _dune_mod)
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
@ -101,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)

View File

@ -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)