Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Bård Skaflestad 2013-08-28 21:10:13 +02:00
commit e06a423920
6 changed files with 107 additions and 27 deletions

View File

@ -199,8 +199,8 @@ if (NOT (ERT_INCLUDE_DIR MATCHES "-NOTFOUND" OR ERT_LIBRARIES MATCHES "-NOTFOUND
check_c_source_compiles (
"#include <ert/ecl/ecl_util.h>
int main (void) {
int sz;
sz = ecl_util_get_sizeof_ctype (ECL_INT_TYPE);
bool ok;
ok = ecl_util_fmt_file (\"foo.bar\", &ok);
return 0;
}" HAVE_ERT)
cmake_pop_check_state ()

View File

@ -161,13 +161,13 @@ foreach (module IN LISTS SuiteSparse_MODULES)
find_path (${MODULE}_INCLUDE_DIR
NAMES ${module}.h
PATHS ${SuiteSparse_SEARCH_PATH}
PATH_SUFFIXES "include" "include/suitesparse" "include/ufsparse"
PATH_SUFFIXES "include" "include/suitesparse" "include/ufsparse" "${MODULE}/Include"
${_no_default_path}
)
find_library (${MODULE}_LIBRARY
NAMES ${module}
PATHS ${SuiteSparse_SEARCH_PATH}
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse"
PATH_SUFFIXES "lib/.libs" "lib" "lib${_BITS}" "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib/ufsparse" "${MODULE}/Lib"
${_no_default_path}
)
# start out by including the module itself; other dependencies will be added later

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)

View File

@ -97,6 +97,15 @@ invalid_opt () {
# default values
prefix=/usr/local
#c_compiler=" -DCMAKE_C_COMPILER=cc"
c_compiler=
c_opts=
#cxx_compiler=" -DCMAKE_CXX_COMPILER=c++"
cxx_compiler=
cxx_opts=
#fort_compiler=" -DCMAKE_Fortran_COMPILER=fc"
fort_compiler=
fort_opts=
#buildtype=" -DCMAKE_BUILD_TYPE=Debug"
buildtype=
#pch_use=" -DPRECOMPILE_HEADERS:BOOL=ON"
@ -120,6 +129,10 @@ use_samples=
use_ninja=
#use_underscoring=" -DUSE_UNDERSCORING=OFF"
use_underscoring=
# boost_root=""
boost_root=
boost_libdir=
boost_opts=
# default is to warn for unknown options, but this can be disabled
option_check=yes
@ -199,8 +212,16 @@ for OPT in "$@"; do
mpi-prefix)
rootvar="_MPI_PREFIX_PATH"
;;
boost)
# special handling of this package, see further below
boost_root="${pkgloc}"
rootvar=""
;;
boost-libdir)
boost_libdir="${pkgloc}"
rootvar=""
;;
alugrid |\
boost |\
eigen3 |\
ert |\
metis |\
@ -405,15 +426,67 @@ done
# remove all arguments processed by getopts
shift $((OPTIND-1))
# remove Autotools-specific variables. notice the usage of a quoted
# array: each element will be returned even with spaces.
# special handling of Boost: if --with-boost-libdir has been used,
# then the --with-boost turns into specifying the header directory
# and not the search root. this mirrors the functionality in the
# Autotools ax_boost_base.m4. necessary because FindBoost in CMake
# uses two different variables if you want to specify them separately
if [ -n "${boost_libdir}" ]; then
boost_opts=" -DBOOST_LIBRARYDIR=\"${boost_libdir}\""
if [ -n "${boost_root}" ]; then
boost_opts="${boost_opts} -DBOOST_INCLUDEDIR=\"${boost_root}\""
fi
else
if [ -n "${boost_root}" ]; then
boost_opts=" -DBOOST_ROOT=\"${boost_root}\""
else
boost_opts=""
fi
fi
# notice the usage of a quoted array: each element will be returned
# even with spaces.
for a in "${VARS[@]}"; do
a="${a/ACLOCAL_*=*/}"
[ -n "$a" ] && ENVVARS="$ENVVARS \"${a/\"/\\\"}\""
case "$a" in
ACLOCAL_*=*)
# remove Autotools-specific variables.
;;
CC=*)
# special processing for compiler options
a=${a#CC=}
c_compiler=" -DCMAKE_C_COMPILER=\"${a/\"/\\\"}\""
;;
CXX=*)
a=${a#CXX=}
cxx_compiler=" -DCMAKE_CXX_COMPILER=\"${a/\"/\\\"}\""
;;
CFLAGS=*)
a=${a#CFLAGS=}
c_opts=" -DCMAKE_C_FLAGS=\"${a/\"/\\\"}\""
;;
CXXFLAGS=*)
a=${a#CXXFLAGS=}
cxx_opts=" -DCMAKE_CXX_FLAGS=\"${a/\"/\\\"}\""
;;
FC=*)
a=${a#FC=}
fort_compiler=" -DCMAKE_Fortran_COMPILER=\"${a/\"/\\\"}\""
;;
FFLAGS=*)
a=${a#FFLAGS=}
fort_opts=" -DCMAKE_Fortran_FLAGS=\"${a/\"/\\\"}\""
;;
*)
ENVVARS="$ENVVARS \"${a/\"/\\\"}\""
;;
esac
done
# only wrap in env command if any variable were actually passed
[ -n "${ENVVARS}" ] && ENVVARS="env ${ENVVARS} "
# pass everything on to CMake
CMDLINE="env ${ENVVARS} ${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples}${use_underscoring} ${FEATURES}"
CMDLINE="${ENVVARS}${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples}${use_underscoring}${c_compiler}${c_opts}${cxx_compiler}${cxx_opts}${fort_compiler}${fort_opts}${boost_opts} ${FEATURES}"
echo --- calling CMake ---
echo ${CMDLINE}
eval exec ${CMDLINE}