diff options
author | Brad King <brad.king@kitware.com> | 2003-07-21 20:38:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2003-07-21 20:38:53 (GMT) |
commit | a1bb1a47129380421fd9490688502ce5bee2e59f (patch) | |
tree | fadcd7e650d2da27ca29c2a5da6195969abe355b | |
parent | d4afed0724866e093f0ae5bf8895ab1e1db3e4c4 (diff) | |
download | CMake-a1bb1a47129380421fd9490688502ce5bee2e59f.zip CMake-a1bb1a47129380421fd9490688502ce5bee2e59f.tar.gz CMake-a1bb1a47129380421fd9490688502ce5bee2e59f.tar.bz2 |
ENH: Added optional configuration of data/doc/man dirs. This will be useful for package maintainers.
-rw-r--r-- | CMakeLists.txt | 18 | ||||
-rw-r--r-- | Modules/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Modules/Platform/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Source/cmCommands.cxx | 4 | ||||
-rw-r--r-- | Source/cmConfigure.cmake.h.in | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 6 | ||||
-rw-r--r-- | Templates/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Utilities/CMakeLists.txt | 33 | ||||
-rwxr-xr-x | bootstrap | 65 |
10 files changed, 110 insertions, 47 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7655d66..4ca9512 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/Modules/CMakeLists.txt b/Modules/CMakeLists.txt index c215833..178acba 100644 --- a/Modules/CMakeLists.txt +++ b/Modules/CMakeLists.txt @@ -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$) diff --git a/Modules/Platform/CMakeLists.txt b/Modules/Platform/CMakeLists.txt index 69f0b74..1054eb5 100644 --- a/Modules/Platform/CMakeLists.txt +++ b/Modules/Platform/CMakeLists.txt @@ -1,2 +1,2 @@ # just install the modules -INSTALL_FILES(/share/CMake/Modules/Platform .*\\.cmake$) +INSTALL_FILES(${CMAKE_DATA_DIR}/Modules/Platform .*\\.cmake$) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index d0c75ed..38cafb6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -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) diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index ccb2d69..7e4f7b2 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -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); diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 8f1ec76..adf8733 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -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@" diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f073271..45838ba 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -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())) diff --git a/Templates/CMakeLists.txt b/Templates/CMakeLists.txt index 739de15..d909231 100644 --- a/Templates/CMakeLists.txt +++ b/Templates/CMakeLists.txt @@ -1,3 +1,3 @@ # just install the modules -INSTALL_PROGRAMS(/share/CMake/Templates install-sh) +INSTALL_PROGRAMS(${CMAKE_DATA_DIR}/Templates install-sh) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index bce5c54..ce48172 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -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 +) @@ -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 "---------------------------------------------" |