summaryrefslogtreecommitdiff
path: root/cmake/configure.pl
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@fe2>2009-11-17 04:45:11 +0100
committerVladislav Vaintroub <vvaintroub@fe2>2009-11-17 04:45:11 +0100
commit1ed6500cf98dfd11d853d4255edbe30a2d6f0a3d (patch)
treeb5ac70176fa9d78654dd999f7e386e92ba16c5e9 /cmake/configure.pl
parenta15d4127fd115069f4322a9ebd4db67af39c977f (diff)
downloadmariadb-git-1ed6500cf98dfd11d853d4255edbe30a2d6f0a3d.tar.gz
Support out of source build with the wrapper configure.pl script
Diffstat (limited to 'cmake/configure.pl')
-rw-r--r--cmake/configure.pl32
1 files changed, 23 insertions, 9 deletions
diff --git a/cmake/configure.pl b/cmake/configure.pl
index ee7846b9c36..3768b046530 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -1,22 +1,35 @@
#!/usr/bin/perl
-use Switch;
+use strict;
+use Cwd 'abs_path';
+use File::Basename;
-my $cmakeargs="";
-foreach $option (@ARGV)
+my $cmakeargs = "";
+
+# Find source root directory
+# Assume this script is in <srcroot>/cmake
+my $srcdir = dirname(dirname(abs_path($0)));
+
+foreach my $option (@ARGV)
{
+
if (substr ($option, 0, 2) == "--")
{
$option = substr($option, 2);
}
+ if($option =~ /srcdir/)
+ {
+ $srcdir = substr($option,7);
+ next;
+ }
if($option =~ /help/)
{
- system("cmake -LH");
+ system("cmake ${srcdir} -LH");
exit(0);
}
if($option =~ /with-plugins=/)
{
my @plugins= split(/,/, substr($option,13));
- foreach $p (@plugins)
+ foreach my $p (@plugins)
{
$p =~ s/-/_/g;
$cmakeargs = $cmakeargs." -DWITH_".uc($p)."=1";
@@ -60,12 +73,12 @@ foreach $option (@ARGV)
$cmakeargs = $cmakeargs." -DCMAKE_INSTALL_PREFIX=".$cmake_install_prefix;
next;
}
- if ($options =~ /extra-charsets=all/)
+ if ($option =~ /extra-charsets=all/)
{
$cmakeargs = $cmakeargs." -DWITH_CHARSETS=all";
next;
}
- if ($options =~ /extra-charsets=complex/)
+ if ($option =~ /extra-charsets=complex/)
{
$cmakeargs = $cmakeargs." -DWITH_CHARSETS=complex";
next;
@@ -74,6 +87,7 @@ foreach $option (@ARGV)
$option =~ s/-/_/g;
$cmakeargs = $cmakeargs." -D".$option."=1";
}
-print("configure.pl : calling cmake . $cmakeargs\n");
-my $rc = system("cmake . $cmakeargs");
+
+print("configure.pl : calling cmake $srcdir $cmakeargs\n");
+my $rc = system("cmake $srcdir $cmakeargs");
exit($rc);