Make building libraries static or shared selectable

Default is still to make a shared object because this is the most
versatile target (it can be included in other shared objects as well
as executables).

Note that due to limitations in CMake, either a shared or a static
library can be built, but not both. (This is due to the fact that on
Windows, an import library has the same name as a static library).
This commit is contained in:
Roland Kaufmann
2012-12-19 14:49:59 +01:00
parent f4f78bf163
commit 34702606ca
2 changed files with 34 additions and 1 deletions

20
configure vendored
View File

@@ -10,6 +10,9 @@ Installation directories:
Optional Features:
--disable-FEATURE do not include FEATURE
--disable-gxx11check do not try flag -std=c++11 to enable C++11 features
--enable-shared build a shared library [default=yes]
--enable-static build a static library [default=no]. Note: only one
of the options shared and static may be built.
Optional Packages:
--with-boost=PATH use Boost library from a specified location
@@ -117,6 +120,23 @@ while getopts -- ":-:" optchar; do
esac
FEATURES="${FEATURES} -DCMAKE_DISABLE_FIND_PACKAGE_${pkgname}=TRUE"
;;
enable-*)
# what kind of library are we building; shared or static?
kind=${OPTARG#enable-}
case "${kind}" in
shared)
shared="ON"
;;
static)
shared="OFF"
;;
*)
invalid_arg --enable-${kind}
exit 1
;;
esac
FEATURES="${FEATURES} -DBUILD_opm-core_SHARED:BOOL=${shared}"
;;
*)
# remove everything *after* the equal sign
arg=${OPTARG%=*}