summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-09-26 18:13:38 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-15 14:46:54 (GMT)
commitc9a5f34bd7d35ebf8a4a326481ce22e809de8e4c (patch)
tree386404512d4f6723701ddd096aea5f3e41e389ad /bootstrap
parentc72f8513f7adc764aafd94f2deb9071ee1f261d9 (diff)
downloadCMake-c9a5f34bd7d35ebf8a4a326481ce22e809de8e4c.zip
CMake-c9a5f34bd7d35ebf8a4a326481ce22e809de8e4c.tar.gz
CMake-c9a5f34bd7d35ebf8a4a326481ce22e809de8e4c.tar.bz2
Cleanup use of CMake version in install destinations
Factor the CMAKE_DATA_DIR, CMAKE_DOC_DIR, and CMAKE_MAN_DIR selection out of CMakeLists.txt and into a Source/CMakeInstallDestinations.cmake script. Load the script from the original location of the code. Cache the destination values as empty strings so we know if the user sets them explicitly. If not, then compute defaults based on the platform and full CMake version string. By not caching the versioned defaults, we can change them in a single build tree as the version changes. Remove duplication of the install destination defaults from the bootstrap script. Cache empty defaults there too. Parse from the CMake code the default values to report in the help output. Keep the CMake code in a structured format to make this reliable.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap39
1 files changed, 30 insertions, 9 deletions
diff --git a/bootstrap b/bootstrap
index 92a88e0..1e7567f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -23,6 +23,15 @@ cmake_version_component()
"
}
+# Install destination extraction function.
+cmake_install_dest_default()
+{
+ cat "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake" | sed -n '
+/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ {
+ s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/;p;q;}
+'
+}
+
cmake_toupper()
{
echo "$1" | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'
@@ -47,9 +56,12 @@ if [ "$cmake_version_rc" != "" ]; then
cmake_version="${cmake_version}-rc${cmake_version_rc}"
fi
-cmake_data_dir="share/cmake-${cmake_version_major}.${cmake_version_minor}"
-cmake_doc_dir="doc/cmake-${cmake_version_major}.${cmake_version_minor}"
-cmake_man_dir="man"
+cmake_data_dir_keyword="OTHER"
+cmake_doc_dir_keyword="OTHER"
+cmake_man_dir_keyword="OTHER"
+cmake_data_dir=""
+cmake_doc_dir=""
+cmake_man_dir=""
cmake_init_file=""
cmake_bootstrap_system_libs=""
cmake_bootstrap_qt_gui=""
@@ -58,6 +70,8 @@ cmake_bootstrap_qt_qmake=""
# Determine whether this is a Cygwin environment.
if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
cmake_system_cygwin=true
+ cmake_doc_dir_keyword="CYGWIN"
+ cmake_man_dir_keyword="CYGWIN"
else
cmake_system_cygwin=false
fi
@@ -79,6 +93,8 @@ fi
# Determine whether this is BeOS
if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
cmake_system_beos=true
+ cmake_doc_dir_keyword="HAIKU"
+ cmake_man_dir_keyword="HAIKU"
else
cmake_system_beos=false
fi
@@ -86,6 +102,8 @@ fi
# Determine whether this is Haiku
if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
cmake_system_haiku=true
+ cmake_doc_dir_keyword="HAIKU"
+ cmake_man_dir_keyword="HAIKU"
else
cmake_system_haiku=false
fi
@@ -164,12 +182,15 @@ if ${cmake_system_mingw}; then
fi
elif ${cmake_system_haiku}; then
cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
- cmake_man_dir="documentation/man"
- cmake_doc_dir="documentation/doc/cmake-${cmake_version}"
else
cmake_default_prefix="/usr/local"
fi
+# Lookup default install destinations.
+cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
+cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
+cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
+
CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
@@ -360,11 +381,11 @@ Directory and file names:
--prefix=PREFIX install files in tree rooted at PREFIX
['"${cmake_default_prefix}"']
--datadir=DIR install data files in PREFIX/DIR
- ['"${cmake_data_dir}"']
+ ['"${cmake_data_dir_default}"']
--docdir=DIR install documentation files in PREFIX/DIR
- ['"${cmake_doc_dir}"']
+ ['"${cmake_doc_dir_default}"']
--mandir=DIR install man pages files in PREFIX/DIR/manN
- ['"${cmake_man_dir}"']
+ ['"${cmake_man_dir_default}"']
'
exit 10
}
@@ -1408,7 +1429,7 @@ cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_versi
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
-cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/${cmake_data_dir}\""
+cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"
# Regenerate configured headers