diff --git a/bin/dunecontrol b/bin/dunecontrol index 155ea6b0974915b2fa300df3f8ace9c55b6fcb19..d95902a4bd78aea9940f84c53e737ad25d09e121 100755 --- a/bin/dunecontrol +++ b/bin/dunecontrol @@ -415,6 +415,11 @@ run_default_configure () { CMAKE_PARAMS="$CMAKE_PARAMS \"-D""$name""_DIR=$path\"" fi fi + # + # Translate the configure PARMS to cmake + export PARAMS + export CMAKE_PARAMS + module_translate_options_am2cmake $m $path/lib fi done @@ -428,6 +433,10 @@ run_default_configure () { SRCDIR="$PWD" cd "$BUILDDIR" echo `pwd` + # Translate the configure PARMS to cmake + export PARAMS + export CMAKE_PARAMS + module_translate_options_am2cmake $m $path/lib echo "cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_MODULE_PATH=\"$CMAKE_MODULE_PATH\" $CMAKE_PARAMS $CMAKE_FLAGS $SRCDIR" eval cmake "-DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_MODULE_PATH=\"$CMAKE_MODULE_PATH\" $CMAKE_PARAMS $CMAKE_FLAGS $SRCDIR" else diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index ca5b5f7ecd973bebcfe4f6c58011f34017f742f5..4c91e04d43cefc757a420daee6222c382a6bf584 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1 +1,2 @@ -install(FILES dunemodules.lib DESTINATION ${CMAKE_INSTALL_BINDIR}/../lib) +install(FILES dunemodules.lib dunecommonam2cmake.lib + DESTINATION ${CMAKE_INSTALL_BINDIR}/../lib) diff --git a/lib/Makefile.am b/lib/Makefile.am index 2f42b259de161806d24474d23754f194f2c7cd79..668814721f0fdd631b4f8eb8754d3aa058e49963 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,8 +1,8 @@ # $Id: $ dunemodulelibdir=$(libdir) -EXTRA_DIST = CMakeLists.txt dunemodules.lib -dunemodulelib_DATA = dunemodules.lib +EXTRA_DIST = CMakeLists.txt dunemodules.lib dunecommonam2cmake.lib +dunemodulelib_DATA = dunemodules.lib dunecommonam2cmake.lib #the dune-common library lib_LTLIBRARIES = libdunecommon.la diff --git a/lib/dunecommonam2cmake.lib b/lib/dunecommonam2cmake.lib new file mode 100644 index 0000000000000000000000000000000000000000..50d26141ae0768deffa9b2aeb897489e393e0c44 --- /dev/null +++ b/lib/dunecommonam2cmake.lib @@ -0,0 +1,21 @@ +# -*-sh-*- + +########################################## +### +### Function for converting configure options +### to CMake options for dune-common +### +########################################## + +# CMake Packages are case sensitive +# This is a list of packages whose names converted +# to lower case are used for configures +# --with-<package> or without-<package> options +# +CMAKE_PACKAGES="Boost Inkscape GMP LAPACK" + +dune_common_options_am2cmake() +{ + default_am2cmake_options $CMAKE_PACKAGES + +} diff --git a/lib/dunemodules.lib b/lib/dunemodules.lib index 30412cd9c33cf45143f96c0c10987b432ef8b373..67b9aaa3270c3cb02adeb69adb89354a44f49b05 100644 --- a/lib/dunemodules.lib +++ b/lib/dunemodules.lib @@ -574,3 +574,58 @@ check_version() { fi return 1 } + +# +# Function that the translates options for configure +# The arguments are the case sensitive cmake package names. +# It is assumed that their lowercase version is used +# for the autotools. This function either deactivates +# a package using CMAKE_DISABLE_FIND_PACKAGE_<package>=TRUE +# or passes th provided path using +# the <CMAKE_PACKAGE_ALL_UPPERCASE>_ROOT variable +default_am2cmake_options(){ + while test "$#" -gt 0; do + package=$1 + lowercase=${1,,} + uppercase=${1^^} + shift + if eval test \$"$lowercase"_processed ; then + continue + fi + export "$lowercase"_processed=1 + # check for --without-$lowercase + echo $PARAMS | grep \\-\\-without-$lowercase > /dev/null + if test "$?" -eq 0 ; then + CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_DISABLE_FIND_PACKAGE_$package=TRUE" + continue + fi + # process --with-$lowercase=<arg> + arg=`echo $PARAMS| sed "s/.*--with-$lowercase=\(\S*\).*/\1/"` + if test "x$arg" = "xno"; then + CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_DISABLE_FIND_PACKAGE_$package=TRUE" + continue + fi + if test -d "$arg"; then + CMAKE_PARAMS="$CMAKE_PARAMS -D$uppercase""_ROOT=$arg" + fi + done + export CMAKE_PARAMS +} + +module_translate_options_am2cmake() +{ + module=$1 # the module name + path=$2 # where the sh libs reside + + # Check whether the module provides a lib named + # <module-without-dashes>autotools2cmake.lib + module_undashed=`echo $module | sed "s/[-_]//g"` + libfile="$path/$module_undashed""am2cmake.lib" + if test -e "$libfile"; then + . $libfile + module_underline=`echo $module | sed "s/-/_/g"` + eval "$module_underline"_options_am2cmake + else + echo "$libfile for converting options does not exist" + fi +}