ENH: Added optional configuration of data/doc/man dirs. This will be useful for package maintainers.
This commit is contained in:
parent
d4afed0724
commit
a1bb1a4712
|
@ -7,6 +7,14 @@ SET(CMake_VERSION_PATCH 0)
|
|||
SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
|
||||
SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
|
||||
|
||||
SET(CMAKE_DATA_DIR "/share/CMake" CACHE STRING
|
||||
"Install location for data (relative to prefix).")
|
||||
SET(CMAKE_DOC_DIR "/doc/CMake" CACHE STRING
|
||||
"Install location for documentation (relative to prefix).")
|
||||
SET(CMAKE_MAN_DIR "/man" CACHE STRING
|
||||
"Install location for man pages (relative to prefix).")
|
||||
MARK_AS_ADVANCED(CMAKE_DATA_DIR CMAKE_DOC_DIR CMAKE_MAN_DIR)
|
||||
|
||||
IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.4)
|
||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio 7")
|
||||
SET(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
|
||||
|
@ -52,14 +60,6 @@ ENABLE_TESTING()
|
|||
|
||||
# Include the standard Dart testing module
|
||||
INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
|
||||
INCLUDE (${CMake_BINARY_DIR}/Bootstrap.cmk/Source/InitialConfigureFlags.cmake
|
||||
OPTIONAL)
|
||||
INCLUDE (${CMake_BINARY_DIR}/Bootstrap.cmk/InitialConfigureFlags.cmake
|
||||
OPTIONAL)
|
||||
|
||||
IF(CMAKE_CONFIGURE_INSTALL_PREFIX)
|
||||
SET(CMAKE_INSTALL_PREFIX ${CMAKE_CONFIGURE_INSTALL_PREFIX} )
|
||||
ENDIF(CMAKE_CONFIGURE_INSTALL_PREFIX)
|
||||
|
||||
# use the ansi CXX compile flag for building cmake
|
||||
|
||||
|
@ -84,8 +84,6 @@ SET(EXECUTABLE_OUTPUT_PATH ${CMake_BINARY_DIR}/bin CACHE PATH
|
|||
|
||||
INCLUDE_REGULAR_EXPRESSION("^(\\.\\./)?(cm|CMake|form|ctest).*")
|
||||
|
||||
INSTALL_FILES(/man/man1 "^cmake\\.1$")
|
||||
|
||||
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
|
||||
${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
|
||||
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# just install the modules
|
||||
SUBDIRS(Platform)
|
||||
INSTALL_FILES(/share/CMake/Modules .*\\.cmake$)
|
||||
INSTALL_FILES(/share/CMake/Modules .*\\.cxx$)
|
||||
INSTALL_FILES(/share/CMake/Modules .*\\.in$)
|
||||
INSTALL_FILES(/share/CMake/Modules .*\\.c$)
|
||||
INSTALL_FILES(${CMAKE_DATA_DIR}/Modules .*\\.cmake$)
|
||||
INSTALL_FILES(${CMAKE_DATA_DIR}/Modules .*\\.cxx$)
|
||||
INSTALL_FILES(${CMAKE_DATA_DIR}/Modules .*\\.in$)
|
||||
INSTALL_FILES(${CMAKE_DATA_DIR}/Modules .*\\.c$)
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
# just install the modules
|
||||
INSTALL_FILES(/share/CMake/Modules/Platform .*\\.cmake$)
|
||||
INSTALL_FILES(${CMAKE_DATA_DIR}/Modules/Platform .*\\.cmake$)
|
||||
|
|
|
@ -356,22 +356,7 @@ ENDIF(BUILD_TESTING)
|
|||
INCLUDE (${CMAKE_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
|
||||
INCLUDE (${CMAKE_SOURCE_DIR}/Source/LocalUserOptions.cmake OPTIONAL)
|
||||
|
||||
IF(WIN32)
|
||||
SET(CMD ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/cmake.exe)
|
||||
ELSE(WIN32)
|
||||
SET(CMD ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/cmake)
|
||||
ENDIF(WIN32)
|
||||
|
||||
MAKE_DIRECTORY(${CMake_BINARY_DIR}/Docs)
|
||||
ADD_CUSTOM_TARGET(documentation ALL ${CMD}
|
||||
--copyright ${CMake_BINARY_DIR}/Docs/Copyright.txt
|
||||
--help-full ${CMake_BINARY_DIR}/Docs/cmake.txt
|
||||
--help-html ${CMake_BINARY_DIR}/Docs/cmake.html
|
||||
--help-man ${CMake_BINARY_DIR}/Docs/cmake.1
|
||||
)
|
||||
ADD_DEPENDENCIES(documentation cmake)
|
||||
|
||||
INSTALL_TARGETS(/bin cmake)
|
||||
INSTALL_TARGETS(/bin ctest)
|
||||
INSTALL_TARGETS(/bin cmaketest)
|
||||
INSTALL_FILES(/share/CMake/include cmCPluginAPI.h)
|
||||
INSTALL_FILES(${CMAKE_DATA_DIR}/include cmCPluginAPI.h)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
// This is sort of a boot strapping approach since you would
|
||||
// like to have CMake to build CMake.
|
||||
#include "cmCommands.h"
|
||||
#include "cmAddCustomCommandCommand.cxx"
|
||||
#include "cmAddCustomTargetCommand.cxx"
|
||||
#include "cmAddDefinitionsCommand.cxx"
|
||||
#include "cmAddDependenciesCommand.cxx"
|
||||
|
@ -74,7 +75,6 @@
|
|||
// support etc, which makes the bootstrap configure file a mess
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
#include "cmAbstractFilesCommand.cxx"
|
||||
#include "cmAddCustomCommandCommand.cxx"
|
||||
#include "cmAuxSourceDirectoryCommand.cxx"
|
||||
#include "cmExportLibraryDependencies.cxx"
|
||||
#include "cmFLTKWrapUICommand.cxx"
|
||||
|
@ -111,6 +111,7 @@
|
|||
|
||||
void GetPredefinedCommands(std::list<cmCommand*>& commands)
|
||||
{
|
||||
commands.push_back(new cmAddCustomCommandCommand);
|
||||
commands.push_back(new cmAddCustomTargetCommand);
|
||||
commands.push_back(new cmAddDefinitionsCommand);
|
||||
commands.push_back(new cmAddDependenciesCommand);
|
||||
|
@ -163,7 +164,6 @@ void GetPredefinedCommands(std::list<cmCommand*>& commands)
|
|||
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
commands.push_back(new cmAbstractFilesCommand);
|
||||
commands.push_back(new cmAddCustomCommandCommand);
|
||||
commands.push_back(new cmAuxSourceDirectoryCommand);
|
||||
commands.push_back(new cmExportLibraryDependenciesCommand);
|
||||
commands.push_back(new cmFLTKWrapUICommand);
|
||||
|
|
|
@ -9,3 +9,5 @@
|
|||
#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@
|
||||
#define CMake_VERSION_MINOR @CMake_VERSION_MINOR@
|
||||
#define CMake_VERSION_PATCH @CMake_VERSION_PATCH@
|
||||
|
||||
#define CMAKE_DATA_DIR "@CMAKE_DATA_DIR@"
|
||||
|
|
|
@ -445,7 +445,7 @@ int cmake::AddCMakePaths(const char *arg0)
|
|||
if (!cmSystemTools::FileExists(modules.c_str()))
|
||||
{
|
||||
// try exe/../share/cmake
|
||||
cMakeRoot += "/share/CMake";
|
||||
cMakeRoot += CMAKE_DATA_DIR;
|
||||
modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
|
||||
}
|
||||
#ifdef CMAKE_ROOT_DIR
|
||||
|
@ -460,7 +460,7 @@ int cmake::AddCMakePaths(const char *arg0)
|
|||
if (!cmSystemTools::FileExists(modules.c_str()))
|
||||
{
|
||||
// try compiled in install prefix
|
||||
cMakeRoot = CMAKE_PREFIX "/share/CMake";
|
||||
cMakeRoot = CMAKE_PREFIX CMAKE_DATA_DIR;
|
||||
modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
|
||||
}
|
||||
#endif
|
||||
|
@ -468,7 +468,7 @@ int cmake::AddCMakePaths(const char *arg0)
|
|||
{
|
||||
// try
|
||||
cMakeRoot = cmSystemTools::GetProgramPath(cMakeSelf.c_str());
|
||||
cMakeRoot += "/share/CMake";
|
||||
cMakeRoot += CMAKE_DATA_DIR;
|
||||
modules = cMakeRoot + "/Modules/CMakeDefaultMakeRuleVariables.cmake";
|
||||
}
|
||||
if(!cmSystemTools::FileExists(modules.c_str()))
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# just install the modules
|
||||
INSTALL_PROGRAMS(/share/CMake/Templates install-sh)
|
||||
INSTALL_PROGRAMS(${CMAKE_DATA_DIR}/Templates install-sh)
|
||||
|
||||
|
|
|
@ -1 +1,34 @@
|
|||
SUBDIRS(Doxygen)
|
||||
|
||||
IF(WIN32)
|
||||
SET(CMD ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/cmake.exe)
|
||||
ELSE(WIN32)
|
||||
SET(CMD ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/cmake)
|
||||
ENDIF(WIN32)
|
||||
|
||||
MAKE_DIRECTORY(${CMake_BINARY_DIR}/Docs)
|
||||
ADD_CUSTOM_TARGET(documentation ALL)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET documentation
|
||||
SOURCE documentation
|
||||
DEPENDS ${CMake_BINARY_DIR}/Docs/Copyright.txt
|
||||
)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET documentation
|
||||
COMMAND ${CMD}
|
||||
ARGS --copyright ${CMake_BINARY_DIR}/Docs/Copyright.txt
|
||||
--help-full ${CMake_BINARY_DIR}/Docs/cmake.txt
|
||||
--help-html ${CMake_BINARY_DIR}/Docs/cmake.html
|
||||
--help-man ${CMake_BINARY_DIR}/Docs/cmake.1
|
||||
DEPENDS ${CMD}
|
||||
SOURCE ${CMake_SOURCE_DIR}/Utilities/Doxygen/authors.txt
|
||||
OUTPUTS ${CMake_BINARY_DIR}/Docs/Copyright.txt
|
||||
)
|
||||
ADD_DEPENDENCIES(documentation cmake)
|
||||
|
||||
INSTALL_FILES(${CMAKE_MAN_DIR}/man1 FILES ${CMake_BINARY_DIR}/Docs/cmake.1)
|
||||
INSTALL_FILES(${CMAKE_DOC_DIR} FILES
|
||||
${CMake_BINARY_DIR}/Docs/Copyright.txt
|
||||
${CMake_BINARY_DIR}/Docs/cmake.txt
|
||||
${CMake_BINARY_DIR}/Docs/cmake.html
|
||||
)
|
||||
|
|
65
bootstrap
65
bootstrap
|
@ -69,11 +69,15 @@ cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
|
|||
cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
|
||||
cmake_binary_dir=`pwd`
|
||||
cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
|
||||
cmake_data_dir="/share/CMake"
|
||||
cmake_doc_dir="/doc/CMake"
|
||||
cmake_man_dir="/man"
|
||||
cmake_init_file=""
|
||||
|
||||
# Display CMake bootstrap usage
|
||||
cmake_usage()
|
||||
{
|
||||
cat<<EOF
|
||||
cat <<EOF
|
||||
Usage: $0 [options]
|
||||
Options: [defaults in brackets after descriptions]
|
||||
Configuration:
|
||||
|
@ -82,10 +86,17 @@ Configuration:
|
|||
--verbose display more information
|
||||
--parallel=n bootstrap cmake in parallel, where n is
|
||||
number of nodes [1]
|
||||
--init=FILE use FILE for cmake initialization
|
||||
|
||||
Directory and file names:
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
--prefix=PREFIX install files in tree rooted at PREFIX
|
||||
[/usr/local]
|
||||
--datadir=DIR install data files in PREFIX/DIR
|
||||
[/share/CMake]
|
||||
--docdir=DIR install documentation files in PREFIX/DIR
|
||||
[/doc/CMake]
|
||||
--mandir=DIR install man pages files in PREFIX/DIR/manN
|
||||
[/man]
|
||||
EOF
|
||||
exit 10
|
||||
}
|
||||
|
@ -240,6 +251,18 @@ for a in "$@"; do
|
|||
if echo $a | grep "^--parallel=" > /dev/null 2> /dev/null; then
|
||||
cmake_parallel_make=`echo $a | sed "s/^--parallel=//" | grep "[0-9][0-9]*"`
|
||||
fi
|
||||
if echo $a | grep "^--datadir=" > /dev/null 2> /dev/null; then
|
||||
cmake_data_dir=`echo $a | sed "s/^--datadir=//"`
|
||||
fi
|
||||
if echo $a | grep "^--docdir=" > /dev/null 2> /dev/null; then
|
||||
cmake_doc_dir=`echo $a | sed "s/^--docdir=//"`
|
||||
fi
|
||||
if echo $a | grep "^--mandir=" > /dev/null 2> /dev/null; then
|
||||
cmake_man_dir=`echo $a | sed "s/^--mandir=//"`
|
||||
fi
|
||||
if echo $a | grep "^--init=" > /dev/null 2> /dev/null; then
|
||||
cmake_init_file=`echo $a | sed "s/^--init=//"`
|
||||
fi
|
||||
if echo $a | grep "^--help" > /dev/null 2> /dev/null; then
|
||||
cmake_usage
|
||||
fi
|
||||
|
@ -306,7 +329,7 @@ fi
|
|||
|
||||
# Check if C compiler works
|
||||
TMPFILE=`cmake_tmp_file`
|
||||
cat>"${TMPFILE}.c"<<EOF
|
||||
cat > "${TMPFILE}.c" <<EOF
|
||||
#include<stdio.h>
|
||||
int main()
|
||||
{
|
||||
|
@ -341,7 +364,7 @@ fi
|
|||
|
||||
# Check if C++ compiler works
|
||||
TMPFILE=`cmake_tmp_file`
|
||||
cat>"${TMPFILE}.cxx"<<EOF
|
||||
cat > "${TMPFILE}.cxx" <<EOF
|
||||
#include <stdio.h>
|
||||
class NeedCXX
|
||||
{
|
||||
|
@ -412,7 +435,7 @@ echo "Make processor on this system is: ${cmake_make_processor}"
|
|||
cmake_test_flags="-LANG:std"
|
||||
if [ "x${cmake_system}" = "xIRIX64" ]; then
|
||||
TMPFILE=`cmake_tmp_file`
|
||||
cat>${TMPFILE}.cxx<<EOF
|
||||
cat > ${TMPFILE}.cxx <<EOF
|
||||
#include <iostream>
|
||||
int main() { std::cout << "No need for ${cmake_test_flags}" << std::endl; return 0;}
|
||||
EOF
|
||||
|
@ -438,7 +461,7 @@ cmake_test_flags=
|
|||
cmake_test_flags="-timplicit_local -no_implicit_include"
|
||||
if [ "x${cmake_system}" = "xOSF1" ]; then
|
||||
TMPFILE=`cmake_tmp_file`
|
||||
cat>${TMPFILE}.cxx<<EOF
|
||||
cat > ${TMPFILE}.cxx <<EOF
|
||||
#include <iostream>
|
||||
int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
|
||||
EOF
|
||||
|
@ -462,7 +485,7 @@ cmake_test_flags=
|
|||
cmake_test_flags="-std strict_ansi -nopure_cname"
|
||||
if [ "x${cmake_system}" = "xOSF1" ]; then
|
||||
TMPFILE=`cmake_tmp_file`
|
||||
cat>${TMPFILE}.cxx<<EOF
|
||||
cat > ${TMPFILE}.cxx <<EOF
|
||||
#include <iostream>
|
||||
int main() { std::cout << "We need ${cmake_test_flags}" << std::endl; return 0;}
|
||||
EOF
|
||||
|
@ -561,6 +584,7 @@ for a in MAJOR MINOR PATCH; do
|
|||
cmake_report cmConfigure.h.tmp "#define CMake_VERSION_${a} ${CMake_VERSION}"
|
||||
done
|
||||
cmake_report cmConfigure.h.tmp "#define CMAKE_ROOT_DIR \"${cmake_source_dir}\""
|
||||
cmake_report cmConfigure.h.tmp "#define CMAKE_DATA_DIR \"${cmake_data_dir}\""
|
||||
cmake_report cmConfigure.h.tmp "#define CMAKE_BOOTSTRAP"
|
||||
|
||||
# Regenerate real cmConfigure.h
|
||||
|
@ -625,8 +649,29 @@ for a in ${KWSYS_CXX_SOURCES}; do
|
|||
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
|
||||
done
|
||||
|
||||
# Write prefix to Bootstrap.cmk/InitialConfigureFlags.cmake
|
||||
echo "SET (CMAKE_CONFIGURE_INSTALL_PREFIX \"${cmake_prefix_dir}\" CACHE PATH \"Install path prefix, prepended onto install directories, For CMake this will always override CMAKE_INSTALL_PREFIX in the cache.\")" > "${cmake_bootstrap_dir}/InitialConfigureFlags.cmake"
|
||||
# Write prefix to Bootstrap.cmk/InitialCacheFlags.cmake
|
||||
cat > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" <<EOF
|
||||
# Generated by ${cmake_source_dir}/bootstrap
|
||||
EOF
|
||||
|
||||
# Start with user-specified settings. Handle relative-path case for
|
||||
# specification of cmake_init_file.
|
||||
(
|
||||
cd "${cmake_binary_dir}"
|
||||
if [ -f "${cmake_init_file}" ]; then
|
||||
cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
||||
fi
|
||||
)
|
||||
|
||||
# Add our default settings.
|
||||
cat >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" <<EOF
|
||||
|
||||
# Default cmake settings. These will not override any settings above.
|
||||
SET (CMAKE_INSTALL_PREFIX "${cmake_prefix_dir}" CACHE PATH "Install path prefix, prepended onto install directories.")
|
||||
SET (CMAKE_DOC_DIR "${cmake_doc_dir}" CACHE PATH "Install location for documentation (relative to prefix).")
|
||||
SET (CMAKE_MAN_DIR "${cmake_man_dir}" CACHE PATH "Install location for man pages (relative to prefix).")
|
||||
SET (CMAKE_DATA_DIR "${cmake_data_dir}" CACHE PATH "Install location for data (relative to prefix).")
|
||||
EOF
|
||||
|
||||
echo "---------------------------------------------"
|
||||
|
||||
|
@ -652,7 +697,7 @@ export CXX
|
|||
export MAKE
|
||||
|
||||
# Run bootstrap CMake to configure real CMake
|
||||
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}"
|
||||
"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
||||
|
||||
echo "---------------------------------------------"
|
||||
|
||||
|
|
Loading…
Reference in New Issue