Commit 0ff3bdba authored by Ken Martin's avatar Ken Martin

better install support

parent 8deccd3c
PROJECT(CMake)
SUBDIRS(Source)
SUBDIRS(Source Modules Templates)
# Include the standard Dart testing module
INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
......@@ -7,52 +7,3 @@ all:
cd Source; ${MAKE}
# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix). The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.
prefix = @prefix@
exec_prefix = @exec_prefix@
# Directory in which to install the program cmake
BIN_INSTALL_DIR = $(exec_prefix)/bin
# Directory in which to install the templates and modules
LIB_INSTALL_DIR = $(exec_prefix)/share/CMake
INSTALL = @srcdir@/install-sh -c
INSTALL_PROGRAM = ${INSTALL} -m 755
INSTALL_DATA = ${INSTALL} -m 644
install:
@for i in $(LIB_INSTALL_DIR)/Modules $(LIB_INSTALL_DIR)/Templates $(BIN_INSTALL_DIR) ; \
do \
if [ ! -d $$i ] ; then \
echo "Making directory $$i"; \
mkdir -p $$i; \
chmod 755 $$i; \
else true; \
fi; \
done;
@echo "Installing CMake"
chmod +x @srcdir@/install-sh
@echo "Installing cmake executable"
@$(INSTALL_PROGRAM) Source/cmake $(BIN_INSTALL_DIR)/cmake
@for i in @srcdir@/Modules/*.cmake*; \
do \
echo "Installing $$i"; \
$(INSTALL_DATA) $$i $(LIB_INSTALL_DIR)/Modules; \
done;
@for i in @srcdir@/Templates/*.cmake*; \
do \
echo "Installing $$i"; \
$(INSTALL_DATA) $$i $(LIB_INSTALL_DIR)/Templates; \
done;
@echo "Installing configure"
@$(INSTALL_PROGRAM) @srcdir@/Templates/configure $(LIB_INSTALL_DIR)/Templates
@echo "Installing install-sh"
@$(INSTALL_PROGRAM) @srcdir@/install-sh $(LIB_INSTALL_DIR)/Templates
# just install the modules
INSTALL_FILES(/share/CMake/Modules .*\.cmake$)
......@@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// cmExecutableCommand
bool cmInstallFilesCommand::InitialPass(std::vector<std::string>& args)
{
if(args.size() < 3)
if(args.size() < 2)
{
this->SetError("called with incorrect number of arguments");
return false;
......@@ -71,7 +71,13 @@ void cmInstallFilesCommand::FinalPass()
std::string testf;
std::string ext = m_FinalArgs[0];
if (tgts.find("INSTALL") != tgts.end())
if (tgts.find("INSTALL") == tgts.end())
{
return;
}
// two different options
if (m_FinalArgs.size() > 1)
{
// now put the files into the list
std::vector<std::string>::iterator s = m_FinalArgs.begin();
......@@ -84,24 +90,39 @@ void cmInstallFilesCommand::FinalPass()
m_Makefile->ExpandVariablesInString(temps);
// look for a srclist
if (m_Makefile->GetSources().find(temps) != m_Makefile->GetSources().end())
{
const std::vector<cmSourceFile> &clsList =
m_Makefile->GetSources().find(temps)->second;
std::vector<cmSourceFile>::const_iterator c = clsList.begin();
for (; c != clsList.end(); ++c)
{
testf = c->GetSourceName() + ext;
// add to the result
tgts["INSTALL"].GetSourceLists().push_back(testf);
}
}
{
const std::vector<cmSourceFile> &clsList =
m_Makefile->GetSources().find(temps)->second;
std::vector<cmSourceFile>::const_iterator c = clsList.begin();
for (; c != clsList.end(); ++c)
{
testf = c->GetSourceName() + ext;
// add to the result
tgts["INSTALL"].GetSourceLists().push_back(testf);
}
}
// if one wasn't found then assume it is a single class
else
{
testf = temps + ext;
// add to the result
tgts["INSTALL"].GetSourceLists().push_back(testf);
}
{
testf = temps + ext;
// add to the result
tgts["INSTALL"].GetSourceLists().push_back(testf);
}
}
}
else // reg exp list
{
std::vector<std::string> files;
cmSystemTools::Glob(m_Makefile->GetCurrentDirectory(),
m_FinalArgs[0].c_str(), files);
std::vector<std::string>::iterator s = files.begin();
// for each argument, get the files
for (;s != files.end(); ++s)
{
tgts["INSTALL"].GetSourceLists().push_back(*s);
}
}
}
......@@ -95,7 +95,8 @@ public:
{
return
"INSTALL_FILES(path extension srclist file file srclist ...)\n"
"Create rules to install the listed files into the path. Path is relative to the variable PREFIX. The files can be specified explicitly or by referenceing source lists. All files must either have the extension specified or exist with the extension appended. A typical extension is .h etc...";
"INSTALL_FILES(path regexp)\n"
"Create rules to install the listed files into the path. Path is relative to the variable CMAKE_INSTALL_PREFIX. There are two forms for this command. In the first the files can be specified explicitly or by referenceing source lists. All files must either have the extension specified or exist with the extension appended. A typical extension is .h etc... In the second form any files in the current directory that match the regular expression will be installed.";
}
cmTypeMacro(cmInstallFilesCommand, cmCommand);
......
......@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sys/stat.h>
#include "cmRegularExpression.h"
#include <ctype.h>
#include "cmDirectory.h"
#if defined(_MSC_VER) || defined(__BORLANDC__)
#include <windows.h>
......@@ -1064,3 +1065,25 @@ std::string cmSystemTools::GetFilenameNameWithoutExtension(const std::string& fi
}
}
void cmSystemTools::Glob(const char *directory, const char *regexp,
std::vector<std::string>& files)
{
cmDirectory d;
cmRegularExpression reg(regexp);
if (d.Load(directory))
{
int i, numf;
numf = d.GetNumberOfFiles();
for (i = 0; i < numf; i++)
{
std::string fname = d.GetFile(i);
if (reg.find(fname))
{
files.push_back(fname);
}
}
}
}
......@@ -204,7 +204,9 @@ public:
///! return true if the file is a directory.
static bool FileIsDirectory(const char* name);
static void Glob(const char *directory, const char *regexp,
std::vector<std::string>& files);
static std::string GetCurrentWorkingDirectory();
static std::string GetProgramPath(const char*);
static void SplitProgramPath(const char* in_name,
......
......@@ -157,19 +157,19 @@ void cmake::AddCMakePaths(const std::vector<std::string>& args)
cMakeRoot = cMakeRoot.substr(0, slashPos);
}
// is there no Modules direcory there?
std::string modules = cMakeRoot + "/Modules";
if (!cmSystemTools::FileIsDirectory(modules.c_str()))
std::string modules = cMakeRoot + "/Modules/FindVTK.cmake";
if (!cmSystemTools::FileExists(modules.c_str()))
{
// try exe/../share/cmake
modules = cMakeRoot + "/share/CMake/Modules";
if (!cmSystemTools::FileIsDirectory(modules.c_str()))
modules = cMakeRoot + "/share/CMake/Modules/FindVTK.cmake";
if (!cmSystemTools::FileExists(modules.c_str()))
{
#ifdef CMAKE_ROOT_DIR
// try compiled in value on UNIX
cMakeRoot = CMAKE_ROOT_DIR;
modules = cMakeRoot + "/Modules";
modules = cMakeRoot + "/Modules/FindVTK.cmake";
#endif
if (!cmSystemTools::FileIsDirectory(modules.c_str()))
if (!cmSystemTools::FileExists(modules.c_str()))
{
// couldn't find modules
cmSystemTools::Error("Could not find CMAKE_ROOT !!!\n",
......
# just install the modules
INSTALL_FILES(/share/CMake/Templates .*\.cmake$)
INSTALL_FILES(/share/CMake/Templates "" configure install-sh)
......@@ -895,89 +895,6 @@ else
fi
fi
ac_aux_dir=
for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f $ac_dir/install.sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
fi
done
if test -z "$ac_aux_dir"; then
{ echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
fi
ac_config_guess=$ac_aux_dir/config.guess
ac_config_sub=$ac_aux_dir/config.sub
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:930: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
# Don't use installbsd from OSF since it installs stuff as root
# by default.
for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
break 2
fi
fi
done
;;
esac
done
IFS="$ac_save_IFS"
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL="$ac_cv_path_install"
else
# As a last resort, use the slow shell script. We don't cache a
# path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the path is relative.
INSTALL="$ac_install_sh"
fi
fi
echo "$ac_t""$INSTALL" 1>&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
fullSrcDir=`cd $srcdir; pwd`
CMAKE_ROOT_DIR=$fullSrcDir
......@@ -1030,7 +947,7 @@ fi
# ansi stream files (without the .h)
if test $ac_cv_prog_gxx = no; then
echo $ac_n "checking ansi standard C++ stream headers ""... $ac_c" 1>&6
echo "configure:1034: checking ansi standard C++ stream headers " >&5
echo "configure:951: checking ansi standard C++ stream headers " >&5
rm -rf conftest.*
cat > conftest.cc <<!
#include <iostream>
......@@ -1049,7 +966,7 @@ fi
# check to see if stl is in the std namespace
if test $ac_cv_prog_gxx = no; then
echo $ac_n "checking ansi standard namespace support ""... $ac_c" 1>&6
echo "configure:1053: checking ansi standard namespace support " >&5
echo "configure:970: checking ansi standard namespace support " >&5
rm -rf conftest.*
cat > conftest.cc <<!
#include <list>
......@@ -1166,7 +1083,6 @@ do
done
ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile Source/Makefile Source/cmConfigure.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
......@@ -1203,9 +1119,6 @@ s%@mandir@%$mandir%g
s%@CMAKE_CONFIG_DIR@%$CMAKE_CONFIG_DIR%g
s%@CC@%$CC%g
s%@CXX@%$CXX%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@CMAKE_ROOT_DIR@%$CMAKE_ROOT_DIR%g
s%@CMAKE_ANSI_CFLAGS@%$CMAKE_ANSI_CFLAGS%g
s%@CMAKE_TEMPLATE_FLAGS@%$CMAKE_TEMPLATE_FLAGS%g
......@@ -1285,10 +1198,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
top_srcdir="$ac_dots$ac_given_srcdir" ;;
esac
case "$ac_given_INSTALL" in
[/$]*) INSTALL="$ac_given_INSTALL" ;;
*) INSTALL="$ac_dots$ac_given_INSTALL" ;;
esac
echo creating "$ac_file"
rm -f "$ac_file"
......@@ -1304,7 +1213,6 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
s%@configure_input@%$configure_input%g
s%@srcdir@%$srcdir%g
s%@top_srcdir@%$top_srcdir%g
s%@INSTALL@%$INSTALL%g
" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
fi; done
rm -f conftest.s*
......
......@@ -11,7 +11,6 @@ AC_SUBST(CMAKE_CONFIG_DIR)
#
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
fullSrcDir=`cd $srcdir; pwd`
CMAKE_ROOT_DIR=$fullSrcDir
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment